diff options
author | Keith Whitwell <keithw@vmware.com> | 2010-10-17 19:03:42 -0700 |
---|---|---|
committer | Keith Whitwell <keithw@vmware.com> | 2010-10-17 19:09:42 -0700 |
commit | 0072acd447dc6be652e63752e50215c3105322c8 (patch) | |
tree | 847d1763b54772d336a04e606f8248291c3092b7 /src/mesa/drivers | |
parent | 543fb77ddece7e1806e8eaa0d65bb2a945ef9a75 (diff) | |
parent | ca2b2ac131933b4171b519813df1aaa3a81621cd (diff) |
Merge remote branch 'origin/master' into lp-setup-llvm
Conflicts:
src/gallium/drivers/llvmpipe/lp_setup_coef.c
src/gallium/drivers/llvmpipe/lp_setup_coef.h
src/gallium/drivers/llvmpipe/lp_setup_coef_intrin.c
src/gallium/drivers/llvmpipe/lp_setup_point.c
src/gallium/drivers/llvmpipe/lp_setup_tri.c
src/gallium/drivers/llvmpipe/lp_state_derived.c
src/gallium/drivers/llvmpipe/lp_state_fs.h
Diffstat (limited to 'src/mesa/drivers')
518 files changed, 8402 insertions, 5740 deletions
diff --git a/src/mesa/drivers/beos/GLView.cpp b/src/mesa/drivers/beos/GLView.cpp index a029f6b200..ee3415b3d1 100644 --- a/src/mesa/drivers/beos/GLView.cpp +++ b/src/mesa/drivers/beos/GLView.cpp @@ -105,7 +105,7 @@ public: MesaDriver(); ~MesaDriver(); - void Init(BGLView * bglview, GLcontext * c, GLvisual * v, GLframebuffer * b); + void Init(BGLView * bglview, struct gl_context * c, struct gl_config * v, struct gl_framebuffer * b); void LockGL(); void UnlockGL(); @@ -120,9 +120,9 @@ private: MesaDriver(const MesaDriver &rhs); // copy constructor illegal MesaDriver &operator=(const MesaDriver &rhs); // assignment oper. illegal - GLcontext * m_glcontext; - GLvisual * m_glvisual; - GLframebuffer * m_glframebuffer; + struct gl_context * m_glcontext; + struct gl_config * m_glvisual; + struct gl_framebuffer * m_glframebuffer; BGLView * m_bglview; BBitmap * m_bitmap; @@ -134,119 +134,119 @@ private: GLuint m_height; // Mesa Device Driver callback functions - static void UpdateState(GLcontext *ctx, GLuint new_state); - static void ClearIndex(GLcontext *ctx, GLuint index); - static void ClearColor(GLcontext *ctx, const GLfloat color[4]); - static void Clear(GLcontext *ctx, GLbitfield mask, + static void UpdateState(struct gl_context *ctx, GLuint new_state); + static void ClearIndex(struct gl_context *ctx, GLuint index); + static void ClearColor(struct gl_context *ctx, const GLfloat color[4]); + static void Clear(struct gl_context *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height); - static void ClearFront(GLcontext *ctx, GLboolean all, GLint x, GLint y, + static void ClearFront(struct gl_context *ctx, GLboolean all, GLint x, GLint y, GLint width, GLint height); - static void ClearBack(GLcontext *ctx, GLboolean all, GLint x, GLint y, + static void ClearBack(struct gl_context *ctx, GLboolean all, GLint x, GLint y, GLint width, GLint height); - static void Index(GLcontext *ctx, GLuint index); - static void Color(GLcontext *ctx, GLubyte r, GLubyte g, + static void Index(struct gl_context *ctx, GLuint index); + static void Color(struct gl_context *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a); - static void SetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer, + static void SetBuffer(struct gl_context *ctx, struct gl_framebuffer *colorBuffer, GLenum mode); - static void GetBufferSize(GLframebuffer * framebuffer, GLuint *width, + static void GetBufferSize(struct gl_framebuffer * framebuffer, GLuint *width, GLuint *height); - static void Error(GLcontext *ctx); - static const GLubyte * GetString(GLcontext *ctx, GLenum name); - static void Viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h); + static void Error(struct gl_context *ctx); + static const GLubyte * GetString(struct gl_context *ctx, GLenum name); + static void Viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h); // Front-buffer functions - static void WriteRGBASpanFront(const GLcontext *ctx, GLuint n, + static void WriteRGBASpanFront(const struct gl_context *ctx, GLuint n, GLint x, GLint y, CONST GLubyte rgba[][4], const GLubyte mask[]); - static void WriteRGBSpanFront(const GLcontext *ctx, GLuint n, + static void WriteRGBSpanFront(const struct gl_context *ctx, GLuint n, GLint x, GLint y, CONST GLubyte rgba[][3], const GLubyte mask[]); - static void WriteMonoRGBASpanFront(const GLcontext *ctx, GLuint n, + static void WriteMonoRGBASpanFront(const struct gl_context *ctx, GLuint n, GLint x, GLint y, const GLchan color[4], const GLubyte mask[]); - static void WriteRGBAPixelsFront(const GLcontext *ctx, GLuint n, + static void WriteRGBAPixelsFront(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], CONST GLubyte rgba[][4], const GLubyte mask[]); - static void WriteMonoRGBAPixelsFront(const GLcontext *ctx, GLuint n, + static void WriteMonoRGBAPixelsFront(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], const GLchan color[4], const GLubyte mask[]); - static void WriteCI32SpanFront(const GLcontext *ctx, GLuint n, + static void WriteCI32SpanFront(const struct gl_context *ctx, GLuint n, GLint x, GLint y, const GLuint index[], const GLubyte mask[]); - static void WriteCI8SpanFront(const GLcontext *ctx, GLuint n, + static void WriteCI8SpanFront(const struct gl_context *ctx, GLuint n, GLint x, GLint y, const GLubyte index[], const GLubyte mask[]); - static void WriteMonoCISpanFront(const GLcontext *ctx, GLuint n, + static void WriteMonoCISpanFront(const struct gl_context *ctx, GLuint n, GLint x, GLint y, GLuint colorIndex, const GLubyte mask[]); - static void WriteCI32PixelsFront(const GLcontext *ctx, + static void WriteCI32PixelsFront(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], const GLuint index[], const GLubyte mask[]); - static void WriteMonoCIPixelsFront(const GLcontext *ctx, GLuint n, + static void WriteMonoCIPixelsFront(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], GLuint colorIndex, const GLubyte mask[]); - static void ReadCI32SpanFront(const GLcontext *ctx, + static void ReadCI32SpanFront(const struct gl_context *ctx, GLuint n, GLint x, GLint y, GLuint index[]); - static void ReadRGBASpanFront(const GLcontext *ctx, GLuint n, + static void ReadRGBASpanFront(const struct gl_context *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4]); - static void ReadCI32PixelsFront(const GLcontext *ctx, + static void ReadCI32PixelsFront(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], GLuint indx[], const GLubyte mask[]); - static void ReadRGBAPixelsFront(const GLcontext *ctx, + static void ReadRGBAPixelsFront(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[]); // Back buffer functions - static void WriteRGBASpanBack(const GLcontext *ctx, GLuint n, + static void WriteRGBASpanBack(const struct gl_context *ctx, GLuint n, GLint x, GLint y, CONST GLubyte rgba[][4], const GLubyte mask[]); - static void WriteRGBSpanBack(const GLcontext *ctx, GLuint n, + static void WriteRGBSpanBack(const struct gl_context *ctx, GLuint n, GLint x, GLint y, CONST GLubyte rgba[][3], const GLubyte mask[]); - static void WriteMonoRGBASpanBack(const GLcontext *ctx, GLuint n, + static void WriteMonoRGBASpanBack(const struct gl_context *ctx, GLuint n, GLint x, GLint y, const GLchan color[4], const GLubyte mask[]); - static void WriteRGBAPixelsBack(const GLcontext *ctx, GLuint n, + static void WriteRGBAPixelsBack(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], CONST GLubyte rgba[][4], const GLubyte mask[]); - static void WriteMonoRGBAPixelsBack(const GLcontext *ctx, GLuint n, + static void WriteMonoRGBAPixelsBack(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], const GLchan color[4], const GLubyte mask[]); - static void WriteCI32SpanBack(const GLcontext *ctx, GLuint n, + static void WriteCI32SpanBack(const struct gl_context *ctx, GLuint n, GLint x, GLint y, const GLuint index[], const GLubyte mask[]); - static void WriteCI8SpanBack(const GLcontext *ctx, GLuint n, GLint x, GLint y, + static void WriteCI8SpanBack(const struct gl_context *ctx, GLuint n, GLint x, GLint y, const GLubyte index[], const GLubyte mask[]); - static void WriteMonoCISpanBack(const GLcontext *ctx, GLuint n, + static void WriteMonoCISpanBack(const struct gl_context *ctx, GLuint n, GLint x, GLint y, GLuint colorIndex, const GLubyte mask[]); - static void WriteCI32PixelsBack(const GLcontext *ctx, + static void WriteCI32PixelsBack(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], const GLuint index[], const GLubyte mask[]); - static void WriteMonoCIPixelsBack(const GLcontext *ctx, + static void WriteMonoCIPixelsBack(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], GLuint colorIndex, const GLubyte mask[]); - static void ReadCI32SpanBack(const GLcontext *ctx, + static void ReadCI32SpanBack(const struct gl_context *ctx, GLuint n, GLint x, GLint y, GLuint index[]); - static void ReadRGBASpanBack(const GLcontext *ctx, GLuint n, + static void ReadRGBASpanBack(const struct gl_context *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4]); - static void ReadCI32PixelsBack(const GLcontext *ctx, + static void ReadCI32PixelsBack(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], GLuint indx[], const GLubyte mask[]); - static void ReadRGBAPixelsBack(const GLcontext *ctx, + static void ReadRGBAPixelsBack(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[]); @@ -297,7 +297,7 @@ BGLView::BGLView(BRect rect, char *name, MesaDriver * md = new MesaDriver(); // examine option flags and create gl_context struct - GLvisual * visual = _mesa_create_visual( dblFlag, + struct gl_config * visual = _mesa_create_visual( dblFlag, stereoFlag, red, green, blue, alpha, depth, @@ -319,7 +319,7 @@ BGLView::BGLView(BRect rect, char *name, functions.Viewport = md->Viewport; // create core context - GLcontext *ctx = _mesa_create_context(visual, NULL, &functions, md); + struct gl_context *ctx = _mesa_create_context(visual, NULL, &functions, md); if (! ctx) { _mesa_destroy_visual(visual); delete md; @@ -332,7 +332,7 @@ BGLView::BGLView(BRect rect, char *name, // create core framebuffer - GLframebuffer * buffer = _mesa_create_framebuffer(visual, + struct gl_framebuffer * buffer = _mesa_create_framebuffer(visual, depth > 0 ? GL_TRUE : GL_FALSE, stencil > 0 ? GL_TRUE: GL_FALSE, accum > 0 ? GL_TRUE : GL_FALSE, @@ -668,7 +668,7 @@ MesaDriver::~MesaDriver() } -void MesaDriver::Init(BGLView * bglview, GLcontext * ctx, GLvisual * visual, GLframebuffer * framebuffer) +void MesaDriver::Init(BGLView * bglview, struct gl_context * ctx, struct gl_config * visual, struct gl_framebuffer * framebuffer) { m_bglview = bglview; m_glcontext = ctx; @@ -815,14 +815,14 @@ void MesaDriver::Draw(BRect updateRect) const } -void MesaDriver::Error(GLcontext *ctx) +void MesaDriver::Error(struct gl_context *ctx) { MesaDriver *md = (MesaDriver *) ctx->DriverCtx; if (md && md->m_bglview) md->m_bglview->ErrorCallback((unsigned long) ctx->ErrorValue); } -void MesaDriver::UpdateState( GLcontext *ctx, GLuint new_state ) +void MesaDriver::UpdateState( struct gl_context *ctx, GLuint new_state ) { struct swrast_device_driver * swdd = _swrast_GetDeviceDriverReference( ctx ); @@ -868,14 +868,14 @@ void MesaDriver::UpdateState( GLcontext *ctx, GLuint new_state ) } -void MesaDriver::ClearIndex(GLcontext *ctx, GLuint index) +void MesaDriver::ClearIndex(struct gl_context *ctx, GLuint index) { MesaDriver *md = (MesaDriver *) ctx->DriverCtx; md->m_clear_index = index; } -void MesaDriver::ClearColor(GLcontext *ctx, const GLfloat color[4]) +void MesaDriver::ClearColor(struct gl_context *ctx, const GLfloat color[4]) { MesaDriver *md = (MesaDriver *) ctx->DriverCtx; CLAMPED_FLOAT_TO_CHAN(md->m_clear_color[BE_RCOMP], color[0]); @@ -886,7 +886,7 @@ void MesaDriver::ClearColor(GLcontext *ctx, const GLfloat color[4]) } -void MesaDriver::Clear(GLcontext *ctx, GLbitfield mask, +void MesaDriver::Clear(struct gl_context *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height) { @@ -903,7 +903,7 @@ void MesaDriver::Clear(GLcontext *ctx, GLbitfield mask, } -void MesaDriver::ClearFront(GLcontext *ctx, +void MesaDriver::ClearFront(struct gl_context *ctx, GLboolean all, GLint x, GLint y, GLint width, GLint height) { @@ -947,7 +947,7 @@ void MesaDriver::ClearFront(GLcontext *ctx, } -void MesaDriver::ClearBack(GLcontext *ctx, +void MesaDriver::ClearBack(struct gl_context *ctx, GLboolean all, GLint x, GLint y, GLint width, GLint height) { @@ -984,7 +984,7 @@ void MesaDriver::ClearBack(GLcontext *ctx, } -void MesaDriver::SetBuffer(GLcontext *ctx, GLframebuffer *buffer, +void MesaDriver::SetBuffer(struct gl_context *ctx, struct gl_framebuffer *buffer, GLenum mode) { /* TODO */ @@ -993,7 +993,7 @@ void MesaDriver::SetBuffer(GLcontext *ctx, GLframebuffer *buffer, (void) mode; } -void MesaDriver::GetBufferSize(GLframebuffer * framebuffer, GLuint *width, +void MesaDriver::GetBufferSize(struct gl_framebuffer * framebuffer, GLuint *width, GLuint *height) { GET_CURRENT_CONTEXT(ctx); @@ -1028,14 +1028,14 @@ void MesaDriver::GetBufferSize(GLframebuffer * framebuffer, GLuint *width, } -void MesaDriver::Viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) +void MesaDriver::Viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { /* poll for window size change and realloc software Z/stencil/etc if needed */ _mesa_ResizeBuffersMESA(); } -const GLubyte *MesaDriver::GetString(GLcontext *ctx, GLenum name) +const GLubyte *MesaDriver::GetString(struct gl_context *ctx, GLenum name) { switch (name) { case GL_RENDERER: @@ -1057,7 +1057,7 @@ inline void Plot(BGLView *bglview, int x, int y) } -void MesaDriver::WriteRGBASpanFront(const GLcontext *ctx, GLuint n, +void MesaDriver::WriteRGBASpanFront(const struct gl_context *ctx, GLuint n, GLint x, GLint y, CONST GLubyte rgba[][4], const GLubyte mask[]) @@ -1082,7 +1082,7 @@ void MesaDriver::WriteRGBASpanFront(const GLcontext *ctx, GLuint n, } } -void MesaDriver::WriteRGBSpanFront(const GLcontext *ctx, GLuint n, +void MesaDriver::WriteRGBSpanFront(const struct gl_context *ctx, GLuint n, GLint x, GLint y, CONST GLubyte rgba[][3], const GLubyte mask[]) @@ -1107,7 +1107,7 @@ void MesaDriver::WriteRGBSpanFront(const GLcontext *ctx, GLuint n, } } -void MesaDriver::WriteMonoRGBASpanFront(const GLcontext *ctx, GLuint n, +void MesaDriver::WriteMonoRGBASpanFront(const struct gl_context *ctx, GLuint n, GLint x, GLint y, const GLchan color[4], const GLubyte mask[]) @@ -1131,7 +1131,7 @@ void MesaDriver::WriteMonoRGBASpanFront(const GLcontext *ctx, GLuint n, } } -void MesaDriver::WriteRGBAPixelsFront(const GLcontext *ctx, +void MesaDriver::WriteRGBAPixelsFront(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], CONST GLubyte rgba[][4], const GLubyte mask[] ) @@ -1156,7 +1156,7 @@ void MesaDriver::WriteRGBAPixelsFront(const GLcontext *ctx, } -void MesaDriver::WriteMonoRGBAPixelsFront(const GLcontext *ctx, GLuint n, +void MesaDriver::WriteMonoRGBAPixelsFront(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], const GLchan color[4], const GLubyte mask[]) @@ -1181,21 +1181,21 @@ void MesaDriver::WriteMonoRGBAPixelsFront(const GLcontext *ctx, GLuint n, } -void MesaDriver::WriteCI32SpanFront( const GLcontext *ctx, GLuint n, GLint x, GLint y, +void MesaDriver::WriteCI32SpanFront( const struct gl_context *ctx, GLuint n, GLint x, GLint y, const GLuint index[], const GLubyte mask[] ) { printf("WriteCI32SpanFront() not implemented yet!\n"); // TODO } -void MesaDriver::WriteCI8SpanFront( const GLcontext *ctx, GLuint n, GLint x, GLint y, +void MesaDriver::WriteCI8SpanFront( const struct gl_context *ctx, GLuint n, GLint x, GLint y, const GLubyte index[], const GLubyte mask[] ) { printf("WriteCI8SpanFront() not implemented yet!\n"); // TODO } -void MesaDriver::WriteMonoCISpanFront( const GLcontext *ctx, GLuint n, +void MesaDriver::WriteMonoCISpanFront( const struct gl_context *ctx, GLuint n, GLint x, GLint y, GLuint colorIndex, const GLubyte mask[] ) { @@ -1204,7 +1204,7 @@ void MesaDriver::WriteMonoCISpanFront( const GLcontext *ctx, GLuint n, } -void MesaDriver::WriteCI32PixelsFront( const GLcontext *ctx, GLuint n, +void MesaDriver::WriteCI32PixelsFront( const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], const GLuint index[], const GLubyte mask[] ) { @@ -1212,7 +1212,7 @@ void MesaDriver::WriteCI32PixelsFront( const GLcontext *ctx, GLuint n, // TODO } -void MesaDriver::WriteMonoCIPixelsFront( const GLcontext *ctx, GLuint n, +void MesaDriver::WriteMonoCIPixelsFront( const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], GLuint colorIndex, const GLubyte mask[] ) { @@ -1221,7 +1221,7 @@ void MesaDriver::WriteMonoCIPixelsFront( const GLcontext *ctx, GLuint n, } -void MesaDriver::ReadCI32SpanFront( const GLcontext *ctx, +void MesaDriver::ReadCI32SpanFront( const struct gl_context *ctx, GLuint n, GLint x, GLint y, GLuint index[] ) { printf("ReadCI32SpanFront() not implemented yet!\n"); @@ -1229,7 +1229,7 @@ void MesaDriver::ReadCI32SpanFront( const GLcontext *ctx, } -void MesaDriver::ReadRGBASpanFront( const GLcontext *ctx, GLuint n, +void MesaDriver::ReadRGBASpanFront( const struct gl_context *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] ) { printf("ReadRGBASpanFront() not implemented yet!\n"); @@ -1237,7 +1237,7 @@ void MesaDriver::ReadRGBASpanFront( const GLcontext *ctx, GLuint n, } -void MesaDriver::ReadCI32PixelsFront( const GLcontext *ctx, +void MesaDriver::ReadCI32PixelsFront( const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], GLuint indx[], const GLubyte mask[] ) { @@ -1246,7 +1246,7 @@ void MesaDriver::ReadCI32PixelsFront( const GLcontext *ctx, } -void MesaDriver::ReadRGBAPixelsFront( const GLcontext *ctx, +void MesaDriver::ReadRGBAPixelsFront( const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] ) { @@ -1257,7 +1257,7 @@ void MesaDriver::ReadRGBAPixelsFront( const GLcontext *ctx, -void MesaDriver::WriteRGBASpanBack(const GLcontext *ctx, GLuint n, +void MesaDriver::WriteRGBASpanBack(const struct gl_context *ctx, GLuint n, GLint x, GLint y, CONST GLubyte rgba[][4], const GLubyte mask[]) @@ -1287,7 +1287,7 @@ void MesaDriver::WriteRGBASpanBack(const GLcontext *ctx, GLuint n, } -void MesaDriver::WriteRGBSpanBack(const GLcontext *ctx, GLuint n, +void MesaDriver::WriteRGBSpanBack(const struct gl_context *ctx, GLuint n, GLint x, GLint y, CONST GLubyte rgb[][3], const GLubyte mask[]) @@ -1319,7 +1319,7 @@ void MesaDriver::WriteRGBSpanBack(const GLcontext *ctx, GLuint n, -void MesaDriver::WriteMonoRGBASpanBack(const GLcontext *ctx, GLuint n, +void MesaDriver::WriteMonoRGBASpanBack(const struct gl_context *ctx, GLuint n, GLint x, GLint y, const GLchan color[4], const GLubyte mask[]) { @@ -1347,7 +1347,7 @@ void MesaDriver::WriteMonoRGBASpanBack(const GLcontext *ctx, GLuint n, } -void MesaDriver::WriteRGBAPixelsBack(const GLcontext *ctx, +void MesaDriver::WriteRGBAPixelsBack(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], CONST GLubyte rgba[][4], const GLubyte mask[] ) @@ -1394,7 +1394,7 @@ void MesaDriver::WriteRGBAPixelsBack(const GLcontext *ctx, } -void MesaDriver::WriteMonoRGBAPixelsBack(const GLcontext *ctx, GLuint n, +void MesaDriver::WriteMonoRGBAPixelsBack(const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], const GLchan color[4], const GLubyte mask[]) @@ -1437,7 +1437,7 @@ void MesaDriver::WriteMonoRGBAPixelsBack(const GLcontext *ctx, GLuint n, } -void MesaDriver::WriteCI32SpanBack( const GLcontext *ctx, GLuint n, +void MesaDriver::WriteCI32SpanBack( const struct gl_context *ctx, GLuint n, GLint x, GLint y, const GLuint index[], const GLubyte mask[] ) { @@ -1445,7 +1445,7 @@ void MesaDriver::WriteCI32SpanBack( const GLcontext *ctx, GLuint n, // TODO } -void MesaDriver::WriteCI8SpanBack( const GLcontext *ctx, GLuint n, +void MesaDriver::WriteCI8SpanBack( const struct gl_context *ctx, GLuint n, GLint x, GLint y, const GLubyte index[], const GLubyte mask[] ) { @@ -1453,7 +1453,7 @@ void MesaDriver::WriteCI8SpanBack( const GLcontext *ctx, GLuint n, // TODO } -void MesaDriver::WriteMonoCISpanBack( const GLcontext *ctx, GLuint n, +void MesaDriver::WriteMonoCISpanBack( const struct gl_context *ctx, GLuint n, GLint x, GLint y, GLuint colorIndex, const GLubyte mask[] ) { @@ -1462,7 +1462,7 @@ void MesaDriver::WriteMonoCISpanBack( const GLcontext *ctx, GLuint n, } -void MesaDriver::WriteCI32PixelsBack( const GLcontext *ctx, GLuint n, +void MesaDriver::WriteCI32PixelsBack( const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], const GLuint index[], const GLubyte mask[] ) { @@ -1470,7 +1470,7 @@ void MesaDriver::WriteCI32PixelsBack( const GLcontext *ctx, GLuint n, // TODO } -void MesaDriver::WriteMonoCIPixelsBack( const GLcontext *ctx, GLuint n, +void MesaDriver::WriteMonoCIPixelsBack( const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], GLuint colorIndex, const GLubyte mask[] ) { @@ -1479,7 +1479,7 @@ void MesaDriver::WriteMonoCIPixelsBack( const GLcontext *ctx, GLuint n, } -void MesaDriver::ReadCI32SpanBack( const GLcontext *ctx, +void MesaDriver::ReadCI32SpanBack( const struct gl_context *ctx, GLuint n, GLint x, GLint y, GLuint index[] ) { printf("ReadCI32SpanBack() not implemented yet!\n"); @@ -1487,7 +1487,7 @@ void MesaDriver::ReadCI32SpanBack( const GLcontext *ctx, } -void MesaDriver::ReadRGBASpanBack( const GLcontext *ctx, GLuint n, +void MesaDriver::ReadRGBASpanBack( const struct gl_context *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] ) { MesaDriver *md = (MesaDriver *) ctx->DriverCtx; @@ -1507,7 +1507,7 @@ void MesaDriver::ReadRGBASpanBack( const GLcontext *ctx, GLuint n, } -void MesaDriver::ReadCI32PixelsBack( const GLcontext *ctx, +void MesaDriver::ReadCI32PixelsBack( const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], GLuint indx[], const GLubyte mask[] ) { @@ -1516,7 +1516,7 @@ void MesaDriver::ReadCI32PixelsBack( const GLcontext *ctx, } -void MesaDriver::ReadRGBAPixelsBack( const GLcontext *ctx, +void MesaDriver::ReadRGBAPixelsBack( const struct gl_context *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] ) { diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index f92cdc5a77..fc67bee98c 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -122,8 +122,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver) /* imaging */ driver->CopyColorTable = _mesa_meta_CopyColorTable; driver->CopyColorSubTable = _mesa_meta_CopyColorSubTable; - driver->CopyConvolutionFilter1D = _mesa_meta_CopyConvolutionFilter1D; - driver->CopyConvolutionFilter2D = _mesa_meta_CopyConvolutionFilter2D; /* Vertex/fragment programs */ driver->BindProgram = NULL; @@ -226,7 +224,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver) * Only the Intel drivers use this so far. */ void -_mesa_init_driver_state(GLcontext *ctx) +_mesa_init_driver_state(struct gl_context *ctx) { ctx->Driver.AlphaFunc(ctx, ctx->Color.AlphaFunc, ctx->Color.AlphaRef); diff --git a/src/mesa/drivers/common/driverfuncs.h b/src/mesa/drivers/common/driverfuncs.h index 4c90ed12f6..212f307424 100644 --- a/src/mesa/drivers/common/driverfuncs.h +++ b/src/mesa/drivers/common/driverfuncs.h @@ -31,7 +31,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver); extern void -_mesa_init_driver_state(GLcontext *ctx); +_mesa_init_driver_state(struct gl_context *ctx); #endif diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 87d116ad9f..9946bf1990 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -40,7 +40,6 @@ #include "main/bufferobj.h" #include "main/buffers.h" #include "main/colortab.h" -#include "main/convolve.h" #include "main/depth.h" #include "main/enable.h" #include "main/fbobject.h" @@ -128,9 +127,6 @@ struct save_state GLfloat AlphaBias, AlphaScale; GLfloat DepthBias, DepthScale; GLboolean MapColorFlag; - GLboolean Convolution1DEnabled; - GLboolean Convolution2DEnabled; - GLboolean Separable2DEnabled; /** META_RASTERIZATION */ GLenum FrontPolygonMode, BackPolygonMode; @@ -288,7 +284,7 @@ struct gl_meta_state * To be called once during context creation. */ void -_mesa_meta_init(GLcontext *ctx) +_mesa_meta_init(struct gl_context *ctx) { ASSERT(!ctx->Meta); @@ -301,7 +297,7 @@ _mesa_meta_init(GLcontext *ctx) * To be called once during context destruction. */ void -_mesa_meta_free(GLcontext *ctx) +_mesa_meta_free(struct gl_context *ctx) { /* Note: Any textures, VBOs, etc, that we allocate should get * freed by the normal context destruction code. But this would be @@ -320,7 +316,7 @@ _mesa_meta_free(GLcontext *ctx) * to save and reset to their defaults */ static void -_mesa_meta_begin(GLcontext *ctx, GLbitfield state) +_mesa_meta_begin(struct gl_context *ctx, GLbitfield state) { struct save_state *save = &ctx->Meta->Save; @@ -389,9 +385,6 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state) save->AlphaScale = ctx->Pixel.AlphaScale; save->AlphaBias = ctx->Pixel.AlphaBias; save->MapColorFlag = ctx->Pixel.MapColorFlag; - save->Convolution1DEnabled = ctx->Pixel.Convolution1DEnabled; - save->Convolution2DEnabled = ctx->Pixel.Convolution2DEnabled; - save->Separable2DEnabled = ctx->Pixel.Separable2DEnabled; ctx->Pixel.RedScale = 1.0F; ctx->Pixel.RedBias = 0.0F; ctx->Pixel.GreenScale = 1.0F; @@ -401,9 +394,6 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state) ctx->Pixel.AlphaScale = 1.0F; ctx->Pixel.AlphaBias = 0.0F; ctx->Pixel.MapColorFlag = GL_FALSE; - ctx->Pixel.Convolution1DEnabled = GL_FALSE; - ctx->Pixel.Convolution2DEnabled = GL_FALSE; - ctx->Pixel.Separable2DEnabled = GL_FALSE; /* XXX more state */ ctx->NewState |=_NEW_PIXEL; } @@ -567,7 +557,7 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state) * Leave meta state. This is like a light-weight version of glPopAttrib(). */ static void -_mesa_meta_end(GLcontext *ctx) +_mesa_meta_end(struct gl_context *ctx) { struct save_state *save = &ctx->Meta->Save; const GLbitfield state = save->SavedState; @@ -638,9 +628,6 @@ _mesa_meta_end(GLcontext *ctx) ctx->Pixel.AlphaScale = save->AlphaScale; ctx->Pixel.AlphaBias = save->AlphaBias; ctx->Pixel.MapColorFlag = save->MapColorFlag; - ctx->Pixel.Convolution1DEnabled = save->Convolution1DEnabled; - ctx->Pixel.Convolution2DEnabled = save->Convolution2DEnabled; - ctx->Pixel.Separable2DEnabled = save->Separable2DEnabled; /* XXX more state */ ctx->NewState |=_NEW_PIXEL; } @@ -837,7 +824,7 @@ invert_z(GLfloat normZ) * Choose tex target, compute max tex size, etc. */ static void -init_temp_texture(GLcontext *ctx, struct temp_texture *tex) +init_temp_texture(struct gl_context *ctx, struct temp_texture *tex) { /* prefer texture rectangle */ if (ctx->Extensions.NV_texture_rectangle) { @@ -863,7 +850,7 @@ init_temp_texture(GLcontext *ctx, struct temp_texture *tex) * This does some one-time init if needed. */ static struct temp_texture * -get_temp_texture(GLcontext *ctx) +get_temp_texture(struct gl_context *ctx) { struct temp_texture *tex = &ctx->Meta->TempTex; @@ -881,7 +868,7 @@ get_temp_texture(GLcontext *ctx) * allocation/deallocation. */ static struct temp_texture * -get_bitmap_temp_texture(GLcontext *ctx) +get_bitmap_temp_texture(struct gl_context *ctx) { struct temp_texture *tex = &ctx->Meta->Bitmap.Tex; @@ -997,7 +984,7 @@ setup_copypix_texture(struct temp_texture *tex, * Setup/load texture for glDrawPixels. */ static void -setup_drawpix_texture(GLcontext *ctx, +setup_drawpix_texture(struct gl_context *ctx, struct temp_texture *tex, GLboolean newTex, GLenum texIntFormat, @@ -1048,7 +1035,7 @@ setup_drawpix_texture(GLcontext *ctx, * One-time init for drawing depth pixels. */ static void -init_blit_depth_pixels(GLcontext *ctx) +init_blit_depth_pixels(struct gl_context *ctx) { static const char *program = "!!ARBfp1.0\n" @@ -1085,7 +1072,7 @@ init_blit_depth_pixels(GLcontext *ctx) * normal path. */ static GLbitfield -blitframebuffer_texture(GLcontext *ctx, +blitframebuffer_texture(struct gl_context *ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) @@ -1214,7 +1201,7 @@ blitframebuffer_texture(GLcontext *ctx, * of texture mapping and polygon rendering. */ void -_mesa_meta_BlitFramebuffer(GLcontext *ctx, +_mesa_meta_BlitFramebuffer(struct gl_context *ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) @@ -1375,7 +1362,7 @@ _mesa_meta_BlitFramebuffer(GLcontext *ctx, * Meta implementation of ctx->Driver.Clear() in terms of polygon rendering. */ void -_mesa_meta_Clear(GLcontext *ctx, GLbitfield buffers) +_mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers) { struct clear_state *clear = &ctx->Meta->Clear; struct vertex { @@ -1493,7 +1480,7 @@ _mesa_meta_Clear(GLcontext *ctx, GLbitfield buffers) * of texture mapping and polygon rendering. */ void -_mesa_meta_CopyPixels(GLcontext *ctx, GLint srcX, GLint srcY, +_mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY, GLsizei width, GLsizei height, GLint dstX, GLint dstY, GLenum type) { @@ -1607,7 +1594,7 @@ _mesa_meta_CopyPixels(GLcontext *ctx, GLint srcX, GLint srcY, * into tiles which fit into the max texture size. */ static void -tiled_draw_pixels(GLcontext *ctx, +tiled_draw_pixels(struct gl_context *ctx, GLint tileSize, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -1643,7 +1630,7 @@ tiled_draw_pixels(GLcontext *ctx, * One-time init for drawing stencil pixels. */ static void -init_draw_stencil_pixels(GLcontext *ctx) +init_draw_stencil_pixels(struct gl_context *ctx) { /* This program is run eight times, once for each stencil bit. * The stencil values to draw are found in an 8-bit alpha texture. @@ -1707,7 +1694,7 @@ init_draw_stencil_pixels(GLcontext *ctx) * One-time init for drawing depth pixels. */ static void -init_draw_depth_pixels(GLcontext *ctx) +init_draw_depth_pixels(struct gl_context *ctx) { static const char *program = "!!ARBfp1.0\n" @@ -1742,7 +1729,7 @@ init_draw_depth_pixels(GLcontext *ctx) * of texture mapping and polygon rendering. */ void -_mesa_meta_DrawPixels(GLcontext *ctx, +_mesa_meta_DrawPixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, @@ -1975,7 +1962,7 @@ _mesa_meta_DrawPixels(GLcontext *ctx, * improve performance a lot. */ void -_mesa_meta_Bitmap(GLcontext *ctx, +_mesa_meta_Bitmap(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap1) @@ -2124,7 +2111,7 @@ _mesa_meta_Bitmap(GLcontext *ctx, * \return GL_TRUE if a fallback is needed, GL_FALSE otherwise */ GLboolean -_mesa_meta_check_generate_mipmap_fallback(GLcontext *ctx, GLenum target, +_mesa_meta_check_generate_mipmap_fallback(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj) { const GLuint fboSave = ctx->DrawBuffer->Name; @@ -2190,7 +2177,7 @@ _mesa_meta_check_generate_mipmap_fallback(GLcontext *ctx, GLenum target, * Note: texture borders and 3D texture support not yet complete. */ void -_mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target, +_mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj) { struct gen_mipmap_state *mipmap = &ctx->Meta->Mipmap; @@ -2507,7 +2494,7 @@ _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target, * ReadPixels() and passed to Tex[Sub]Image(). */ static GLenum -get_temp_image_type(GLcontext *ctx, GLenum baseFormat) +get_temp_image_type(struct gl_context *ctx, GLenum baseFormat) { switch (baseFormat) { case GL_RGBA: @@ -2538,7 +2525,7 @@ get_temp_image_type(GLcontext *ctx, GLenum baseFormat) * Have to be careful with locking and meta state for pixel transfer. */ static void -copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level, +copy_tex_image(struct gl_context *ctx, GLuint dims, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { @@ -2579,14 +2566,6 @@ copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level, format, type, &ctx->Pack, buf); _mesa_meta_end(ctx); - /* - * Prepare for new texture image size/data - */ - if (_mesa_is_color_format(internalFormat)) { - _mesa_adjust_image_for_convolution(ctx, 2, - &postConvWidth, &postConvHeight); - } - if (texImage->Data) { ctx->Driver.FreeTexImageData(ctx, texImage); } @@ -2624,7 +2603,7 @@ copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level, void -_mesa_meta_CopyTexImage1D(GLcontext *ctx, GLenum target, GLint level, +_mesa_meta_CopyTexImage1D(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border) { @@ -2634,7 +2613,7 @@ _mesa_meta_CopyTexImage1D(GLcontext *ctx, GLenum target, GLint level, void -_mesa_meta_CopyTexImage2D(GLcontext *ctx, GLenum target, GLint level, +_mesa_meta_CopyTexImage2D(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { @@ -2649,7 +2628,7 @@ _mesa_meta_CopyTexImage2D(GLcontext *ctx, GLenum target, GLint level, * Have to be careful with locking and meta state for pixel transfer. */ static void -copy_tex_sub_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level, +copy_tex_sub_image(struct gl_context *ctx, GLuint dims, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) @@ -2720,7 +2699,7 @@ copy_tex_sub_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level, void -_mesa_meta_CopyTexSubImage1D(GLcontext *ctx, GLenum target, GLint level, +_mesa_meta_CopyTexSubImage1D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) { @@ -2730,7 +2709,7 @@ _mesa_meta_CopyTexSubImage1D(GLcontext *ctx, GLenum target, GLint level, void -_mesa_meta_CopyTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, +_mesa_meta_CopyTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) @@ -2741,7 +2720,7 @@ _mesa_meta_CopyTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, void -_mesa_meta_CopyTexSubImage3D(GLcontext *ctx, GLenum target, GLint level, +_mesa_meta_CopyTexSubImage3D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) @@ -2752,7 +2731,7 @@ _mesa_meta_CopyTexSubImage3D(GLcontext *ctx, GLenum target, GLint level, void -_mesa_meta_CopyColorTable(GLcontext *ctx, +_mesa_meta_CopyColorTable(struct gl_context *ctx, GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) { @@ -2780,7 +2759,7 @@ _mesa_meta_CopyColorTable(GLcontext *ctx, void -_mesa_meta_CopyColorSubTable(GLcontext *ctx,GLenum target, GLsizei start, +_mesa_meta_CopyColorSubTable(struct gl_context *ctx,GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) { GLfloat *buf; @@ -2804,64 +2783,3 @@ _mesa_meta_CopyColorSubTable(GLcontext *ctx,GLenum target, GLsizei start, free(buf); } - - -void -_mesa_meta_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, - GLenum internalFormat, - GLint x, GLint y, GLsizei width) -{ - GLfloat *buf; - - buf = (GLfloat *) malloc(width * 4 * sizeof(GLfloat)); - if (!buf) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyConvolutionFilter2D"); - return; - } - - /* - * Read image from framebuffer (disable pixel transfer ops) - */ - _mesa_meta_begin(ctx, META_PIXEL_STORE | META_PIXEL_TRANSFER); - _mesa_update_state(ctx); - ctx->Driver.ReadPixels(ctx, x, y, width, 1, - GL_RGBA, GL_FLOAT, &ctx->Pack, buf); - - _mesa_ConvolutionFilter1D(target, internalFormat, width, - GL_RGBA, GL_FLOAT, buf); - - _mesa_meta_end(ctx); - - free(buf); -} - - -void -_mesa_meta_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, - GLenum internalFormat, GLint x, GLint y, - GLsizei width, GLsizei height) -{ - GLfloat *buf; - - buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - if (!buf) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyConvolutionFilter2D"); - return; - } - - /* - * Read image from framebuffer (disable pixel transfer ops) - */ - _mesa_meta_begin(ctx, META_PIXEL_STORE | META_PIXEL_TRANSFER); - _mesa_update_state(ctx); - - ctx->Driver.ReadPixels(ctx, x, y, width, height, - GL_RGBA, GL_FLOAT, &ctx->Pack, buf); - - _mesa_ConvolutionFilter2D(target, internalFormat, width, height, - GL_RGBA, GL_FLOAT, buf); - - _mesa_meta_end(ctx); - - free(buf); -} diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index 6225b94189..b0797d3d91 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -28,89 +28,89 @@ extern void -_mesa_meta_init(GLcontext *ctx); +_mesa_meta_init(struct gl_context *ctx); extern void -_mesa_meta_free(GLcontext *ctx); +_mesa_meta_free(struct gl_context *ctx); extern void -_mesa_meta_BlitFramebuffer(GLcontext *ctx, +_mesa_meta_BlitFramebuffer(struct gl_context *ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); extern void -_mesa_meta_Clear(GLcontext *ctx, GLbitfield buffers); +_mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers); extern void -_mesa_meta_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, +_mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type); extern void -_mesa_meta_DrawPixels(GLcontext *ctx, +_mesa_meta_DrawPixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels); extern void -_mesa_meta_Bitmap(GLcontext *ctx, +_mesa_meta_Bitmap(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap); extern GLboolean -_mesa_meta_check_generate_mipmap_fallback(GLcontext *ctx, GLenum target, +_mesa_meta_check_generate_mipmap_fallback(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj); extern void -_mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target, +_mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj); extern void -_mesa_meta_CopyTexImage1D(GLcontext *ctx, GLenum target, GLint level, +_mesa_meta_CopyTexImage1D(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border); extern void -_mesa_meta_CopyTexImage2D(GLcontext *ctx, GLenum target, GLint level, +_mesa_meta_CopyTexImage2D(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); extern void -_mesa_meta_CopyTexSubImage1D(GLcontext *ctx, GLenum target, GLint level, +_mesa_meta_CopyTexSubImage1D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); extern void -_mesa_meta_CopyTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, +_mesa_meta_CopyTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); extern void -_mesa_meta_CopyTexSubImage3D(GLcontext *ctx, GLenum target, GLint level, +_mesa_meta_CopyTexSubImage3D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); extern void -_mesa_meta_CopyColorTable(GLcontext *ctx, +_mesa_meta_CopyColorTable(struct gl_context *ctx, GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); extern void -_mesa_meta_CopyColorSubTable(GLcontext *ctx,GLenum target, GLsizei start, +_mesa_meta_CopyColorSubTable(struct gl_context *ctx,GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); extern void -_mesa_meta_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, +_mesa_meta_CopyConvolutionFilter1D(struct gl_context *ctx, GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width); extern void -_mesa_meta_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, +_mesa_meta_CopyConvolutionFilter2D(struct gl_context *ctx, GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/mesa/drivers/dri/common/depthtmp.h b/src/mesa/drivers/dri/common/depthtmp.h index fd2dab3b42..81bec9c5ff 100644 --- a/src/mesa/drivers/dri/common/depthtmp.h +++ b/src/mesa/drivers/dri/common/depthtmp.h @@ -21,7 +21,7 @@ #define HAVE_HW_DEPTH_PIXELS 0 #endif -static void TAG(WriteDepthSpan)( GLcontext *ctx, +static void TAG(WriteDepthSpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *values, @@ -72,7 +72,7 @@ static void TAG(WriteDepthSpan)( GLcontext *ctx, #if HAVE_HW_DEPTH_SPANS /* implement MonoWriteDepthSpan() in terms of WriteDepthSpan() */ static void -TAG(WriteMonoDepthSpan)( GLcontext *ctx, struct gl_renderbuffer *rb, +TAG(WriteMonoDepthSpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *value, const GLubyte mask[] ) { @@ -84,7 +84,7 @@ TAG(WriteMonoDepthSpan)( GLcontext *ctx, struct gl_renderbuffer *rb, TAG(WriteDepthSpan)(ctx, rb, n, x, y, depths, mask); } #else -static void TAG(WriteMonoDepthSpan)( GLcontext *ctx, +static void TAG(WriteMonoDepthSpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *value, @@ -124,7 +124,7 @@ static void TAG(WriteMonoDepthSpan)( GLcontext *ctx, #endif -static void TAG(WriteDepthPixels)( GLcontext *ctx, +static void TAG(WriteDepthPixels)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], @@ -173,7 +173,7 @@ static void TAG(WriteDepthPixels)( GLcontext *ctx, /* Read depth spans and pixels */ -static void TAG(ReadDepthSpan)( GLcontext *ctx, +static void TAG(ReadDepthSpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, void *values ) @@ -207,7 +207,7 @@ static void TAG(ReadDepthSpan)( GLcontext *ctx, HW_READ_UNLOCK(); } -static void TAG(ReadDepthPixels)( GLcontext *ctx, +static void TAG(ReadDepthPixels)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], diff --git a/src/mesa/drivers/dri/common/dri_metaops.c b/src/mesa/drivers/dri/common/dri_metaops.c index a2f404b616..e0bc3b88ec 100644 --- a/src/mesa/drivers/dri/common/dri_metaops.c +++ b/src/mesa/drivers/dri/common/dri_metaops.c @@ -41,7 +41,7 @@ void meta_set_passthrough_transform(struct dri_metaops *meta) { - GLcontext *ctx = meta->ctx; + struct gl_context *ctx = meta->ctx; meta->saved_vp_x = ctx->Viewport.X; meta->saved_vp_y = ctx->Viewport.Y; @@ -87,7 +87,7 @@ meta_restore_transform(struct dri_metaops *meta) void meta_set_passthrough_vertex_program(struct dri_metaops *meta) { - GLcontext *ctx = meta->ctx; + struct gl_context *ctx = meta->ctx; static const char *vp = "!!ARBvp1.0\n" "TEMP vertexClip;\n" @@ -133,7 +133,7 @@ meta_set_passthrough_vertex_program(struct dri_metaops *meta) void meta_restore_vertex_program(struct dri_metaops *meta) { - GLcontext *ctx = meta->ctx; + struct gl_context *ctx = meta->ctx; FLUSH_VERTICES(ctx, _NEW_PROGRAM); _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, @@ -155,7 +155,7 @@ meta_set_fragment_program(struct dri_metaops *meta, struct gl_fragment_program **prog, const char *prog_string) { - GLcontext *ctx = meta->ctx; + struct gl_context *ctx = meta->ctx; assert(meta->saved_fp == NULL); _mesa_reference_fragprog(ctx, &meta->saved_fp, @@ -187,7 +187,7 @@ meta_set_fragment_program(struct dri_metaops *meta, void meta_restore_fragment_program(struct dri_metaops *meta) { - GLcontext *ctx = meta->ctx; + struct gl_context *ctx = meta->ctx; FLUSH_VERTICES(ctx, _NEW_PROGRAM); _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, @@ -208,7 +208,7 @@ static const float default_texcoords[4][2] = { { 0.0, 0.0 }, void meta_set_default_texrect(struct dri_metaops *meta) { - GLcontext *ctx = meta->ctx; + struct gl_context *ctx = meta->ctx; struct gl_client_array *old_texcoord_array; meta->saved_active_texture = ctx->Texture.CurrentUnit; @@ -249,7 +249,7 @@ meta_set_default_texrect(struct dri_metaops *meta) void meta_restore_texcoords(struct dri_metaops *meta) { - GLcontext *ctx = meta->ctx; + struct gl_context *ctx = meta->ctx; /* Restore the old TexCoordPointer */ if (meta->saved_texcoord_vbo) { @@ -280,7 +280,7 @@ meta_restore_texcoords(struct dri_metaops *meta) } -void meta_init_metaops(GLcontext *ctx, struct dri_metaops *meta) +void meta_init_metaops(struct gl_context *ctx, struct dri_metaops *meta) { meta->ctx = ctx; } diff --git a/src/mesa/drivers/dri/common/dri_metaops.h b/src/mesa/drivers/dri/common/dri_metaops.h index 2487145326..aa7d4baa6e 100644 --- a/src/mesa/drivers/dri/common/dri_metaops.h +++ b/src/mesa/drivers/dri/common/dri_metaops.h @@ -31,7 +31,7 @@ struct dri_metaops { - GLcontext *ctx; + struct gl_context *ctx; GLboolean internal_viewport_call; struct gl_fragment_program *bitmap_fp; struct gl_vertex_program *passthrough_vp; @@ -75,7 +75,7 @@ void meta_set_default_texrect(struct dri_metaops *meta); void meta_restore_texcoords(struct dri_metaops *meta); -void meta_init_metaops(GLcontext *ctx, struct dri_metaops *meta); +void meta_init_metaops(struct gl_context *ctx, struct dri_metaops *meta); void meta_destroy_metaops(struct dri_metaops *meta); #endif diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index f07c3da4bb..a5b71bd40a 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -444,8 +444,7 @@ driCreateNewDrawable(__DRIscreen *psp, const __DRIconfig *config, pdp->driScreenPriv = psp; - if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, &config->modes, - renderType == GLX_PIXMAP_BIT)) { + if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, &config->modes, 0)) { free(pdp); return NULL; } @@ -635,7 +634,7 @@ dri2CreateNewContextForAPI(__DRIscreen *screen, int api, __DRIcontext *shared, void *data) { __DRIcontext *context; - const __GLcontextModes *modes = (config != NULL) ? &config->modes : NULL; + const struct gl_config *modes = (config != NULL) ? &config->modes : NULL; void *shareCtx = (shared != NULL) ? shared->driverPrivate : NULL; gl_api mesa_api; @@ -755,7 +754,7 @@ setupLoaderExtensions(__DRIscreen *psp, * This is the bootstrap function for the driver. libGL supplies all of the * requisite information about the system, and the driver initializes itself. * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or + * with the \c struct gl_config that the driver can support for windows or * pbuffers. * * For legacy DRI. @@ -880,6 +879,7 @@ dri2CreateNewScreen(int scrn, int fd, } psp->DriverAPI = driDriverAPI; + psp->loaderPrivate = data; driParseOptionInfo(&psp->optionInfo, __dri2ConfigOptions, __dri2NConfigOptions); diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 5096d22cad..ffffb99b30 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -54,7 +54,6 @@ #include "xmlconfig.h" #include "main/glheader.h" #include "main/mtypes.h" -#include "GL/internal/glcore.h" #include "GL/internal/dri_interface.h" #define GLX_BAD_CONTEXT 5 @@ -149,7 +148,7 @@ struct __DriverAPIRec { * Context creation callback */ GLboolean (*CreateContext)(gl_api api, - const __GLcontextModes *glVis, + const struct gl_config *glVis, __DRIcontext *driContextPriv, void *sharedContextPrivate); @@ -163,7 +162,7 @@ struct __DriverAPIRec { */ GLboolean (*CreateBuffer)(__DRIscreen *driScrnPriv, __DRIdrawable *driDrawPriv, - const __GLcontextModes *glVis, + const struct gl_config *glVis, GLboolean pixmapBuffer); /** @@ -539,6 +538,7 @@ struct __DRIscreenRec { driOptionCache optionInfo; driOptionCache optionCache; unsigned int api_mask; + void *loaderPrivate; }; extern void diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.c b/src/mesa/drivers/dri/common/drirenderbuffer.c index c9ce6e3cb6..7ac1ab169e 100644 --- a/src/mesa/drivers/dri/common/drirenderbuffer.c +++ b/src/mesa/drivers/dri/common/drirenderbuffer.c @@ -16,7 +16,7 @@ * be used. */ static GLboolean -driRenderbufferStorage(GLcontext *ctx, struct gl_renderbuffer *rb, +driRenderbufferStorage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { rb->Width = width; @@ -187,7 +187,7 @@ driFlipRenderbuffers(struct gl_framebuffer *fb, GLboolean flipped) * gl_framebuffer object. */ void -driUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawable *dPriv) +driUpdateFramebufferSize(struct gl_context *ctx, const __DRIdrawable *dPriv) { struct gl_framebuffer *fb = (struct gl_framebuffer *) dPriv->driverPrivate; if (fb && (dPriv->w != fb->Width || dPriv->h != fb->Height)) { diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.h b/src/mesa/drivers/dri/common/drirenderbuffer.h index 677511334d..0cae7309df 100644 --- a/src/mesa/drivers/dri/common/drirenderbuffer.h +++ b/src/mesa/drivers/dri/common/drirenderbuffer.h @@ -73,7 +73,7 @@ driFlipRenderbuffers(struct gl_framebuffer *fb, GLboolean flipped); extern void -driUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawable *dPriv); +driUpdateFramebufferSize(struct gl_context *ctx, const __DRIdrawable *dPriv); #endif /* DRIRENDERBUFFER_H */ diff --git a/src/mesa/drivers/dri/common/drisw_util.h b/src/mesa/drivers/dri/common/drisw_util.h index 9c3d01c99c..d43f5235aa 100644 --- a/src/mesa/drivers/dri/common/drisw_util.h +++ b/src/mesa/drivers/dri/common/drisw_util.h @@ -39,7 +39,6 @@ #include "main/mtypes.h" #include <GL/gl.h> -#include <GL/internal/glcore.h> #include <GL/internal/dri_interface.h> typedef struct _drmLock drmLock; @@ -60,7 +59,7 @@ struct __DriverAPIRec { void (*DestroyScreen)(__DRIscreen *driScrnPriv); GLboolean (*CreateContext)(gl_api glapi, - const __GLcontextModes *glVis, + const struct gl_config *glVis, __DRIcontext *driContextPriv, void *sharedContextPrivate); @@ -68,7 +67,7 @@ struct __DriverAPIRec { GLboolean (*CreateBuffer)(__DRIscreen *driScrnPriv, __DRIdrawable *driDrawPriv, - const __GLcontextModes *glVis, + const struct gl_config *glVis, GLboolean pixmapBuffer); void (*DestroyBuffer)(__DRIdrawable *driDrawPriv); diff --git a/src/mesa/drivers/dri/common/spantmp.h b/src/mesa/drivers/dri/common/spantmp.h index cdc4f422ce..f0af5b1c58 100644 --- a/src/mesa/drivers/dri/common/spantmp.h +++ b/src/mesa/drivers/dri/common/spantmp.h @@ -42,7 +42,7 @@ #endif -static void TAG(WriteRGBASpan)( GLcontext *ctx, +static void TAG(WriteRGBASpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *values, const GLubyte mask[] ) @@ -85,7 +85,7 @@ static void TAG(WriteRGBASpan)( GLcontext *ctx, HW_WRITE_UNLOCK(); } -static void TAG(WriteRGBSpan)( GLcontext *ctx, +static void TAG(WriteRGBSpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *values, const GLubyte mask[] ) @@ -124,7 +124,7 @@ static void TAG(WriteRGBSpan)( GLcontext *ctx, HW_WRITE_UNLOCK(); } -static void TAG(WriteRGBAPixels)( GLcontext *ctx, +static void TAG(WriteRGBAPixels)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], const void *values, const GLubyte mask[] ) @@ -170,7 +170,7 @@ static void TAG(WriteRGBAPixels)( GLcontext *ctx, } -static void TAG(WriteMonoRGBASpan)( GLcontext *ctx, +static void TAG(WriteMonoRGBASpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *value, @@ -210,7 +210,7 @@ static void TAG(WriteMonoRGBASpan)( GLcontext *ctx, } -static void TAG(WriteMonoRGBAPixels)( GLcontext *ctx, +static void TAG(WriteMonoRGBAPixels)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], @@ -252,7 +252,7 @@ static void TAG(WriteMonoRGBAPixels)( GLcontext *ctx, } -static void TAG(ReadRGBASpan)( GLcontext *ctx, +static void TAG(ReadRGBASpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, void *values) @@ -280,7 +280,7 @@ static void TAG(ReadRGBASpan)( GLcontext *ctx, } -static void TAG(ReadRGBAPixels)( GLcontext *ctx, +static void TAG(ReadRGBAPixels)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], void *values ) diff --git a/src/mesa/drivers/dri/common/spantmp2.h b/src/mesa/drivers/dri/common/spantmp2.h index 1dab7336b9..abd79562f9 100644 --- a/src/mesa/drivers/dri/common/spantmp2.h +++ b/src/mesa/drivers/dri/common/spantmp2.h @@ -460,7 +460,7 @@ #include "x86/common_x86_asm.h" #endif -static void TAG(WriteRGBASpan)( GLcontext *ctx, +static void TAG(WriteRGBASpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *values, const GLubyte mask[] ) @@ -503,7 +503,7 @@ static void TAG(WriteRGBASpan)( GLcontext *ctx, HW_WRITE_UNLOCK(); } -static void TAG(WriteRGBSpan)( GLcontext *ctx, +static void TAG(WriteRGBSpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *values, const GLubyte mask[] ) @@ -542,7 +542,7 @@ static void TAG(WriteRGBSpan)( GLcontext *ctx, HW_WRITE_UNLOCK(); } -static void TAG(WriteRGBAPixels)( GLcontext *ctx, +static void TAG(WriteRGBAPixels)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], const void *values, const GLubyte mask[] ) @@ -588,7 +588,7 @@ static void TAG(WriteRGBAPixels)( GLcontext *ctx, } -static void TAG(WriteMonoRGBASpan)( GLcontext *ctx, +static void TAG(WriteMonoRGBASpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *value, const GLubyte mask[] ) @@ -627,7 +627,7 @@ static void TAG(WriteMonoRGBASpan)( GLcontext *ctx, } -static void TAG(WriteMonoRGBAPixels)( GLcontext *ctx, +static void TAG(WriteMonoRGBAPixels)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], @@ -669,7 +669,7 @@ static void TAG(WriteMonoRGBAPixels)( GLcontext *ctx, } -static void TAG(ReadRGBASpan)( GLcontext *ctx, +static void TAG(ReadRGBASpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, void *values) { @@ -702,7 +702,7 @@ static void TAG(ReadRGBASpan)( GLcontext *ctx, (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)) || \ ((SPANTMP_PIXEL_FMT == GL_RGB) && \ (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5))) -static void TAG2(ReadRGBASpan,_MMX)( GLcontext *ctx, +static void TAG2(ReadRGBASpan,_MMX)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, void *values) { @@ -752,7 +752,7 @@ static void TAG2(ReadRGBASpan,_MMX)( GLcontext *ctx, defined(USE_SSE_ASM) && \ (SPANTMP_PIXEL_FMT == GL_BGRA) && \ (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV) -static void TAG2(ReadRGBASpan,_SSE2)( GLcontext *ctx, +static void TAG2(ReadRGBASpan,_SSE2)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, void *values) @@ -787,7 +787,7 @@ static void TAG2(ReadRGBASpan,_SSE2)( GLcontext *ctx, defined(USE_SSE_ASM) && \ (SPANTMP_PIXEL_FMT == GL_BGRA) && \ (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV) -static void TAG2(ReadRGBASpan,_SSE)( GLcontext *ctx, +static void TAG2(ReadRGBASpan,_SSE)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, void *values) @@ -829,7 +829,7 @@ static void TAG2(ReadRGBASpan,_SSE)( GLcontext *ctx, #endif -static void TAG(ReadRGBAPixels)( GLcontext *ctx, +static void TAG(ReadRGBAPixels)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], void *values ) diff --git a/src/mesa/drivers/dri/common/stenciltmp.h b/src/mesa/drivers/dri/common/stenciltmp.h index 2b10b9ecfe..fef0972089 100644 --- a/src/mesa/drivers/dri/common/stenciltmp.h +++ b/src/mesa/drivers/dri/common/stenciltmp.h @@ -13,7 +13,7 @@ #define HAVE_HW_STENCIL_PIXELS 0 #endif -static void TAG(WriteStencilSpan)( GLcontext *ctx, +static void TAG(WriteStencilSpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *values, const GLubyte mask[] ) @@ -64,7 +64,7 @@ static void TAG(WriteStencilSpan)( GLcontext *ctx, #if HAVE_HW_STENCIL_SPANS /* implement MonoWriteDepthSpan() in terms of WriteDepthSpan() */ static void -TAG(WriteMonoStencilSpan)( GLcontext *ctx, struct gl_renderbuffer *rb, +TAG(WriteMonoStencilSpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *value, const GLubyte mask[] ) { @@ -76,7 +76,7 @@ TAG(WriteMonoStencilSpan)( GLcontext *ctx, struct gl_renderbuffer *rb, TAG(WriteStencilSpan)(ctx, rb, n, x, y, stens, mask); } #else /* HAVE_HW_STENCIL_SPANS */ -static void TAG(WriteMonoStencilSpan)( GLcontext *ctx, +static void TAG(WriteMonoStencilSpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *value, @@ -118,7 +118,7 @@ static void TAG(WriteMonoStencilSpan)( GLcontext *ctx, #endif /* !HAVE_HW_STENCIL_SPANS */ -static void TAG(WriteStencilPixels)( GLcontext *ctx, +static void TAG(WriteStencilPixels)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], @@ -157,7 +157,7 @@ static void TAG(WriteStencilPixels)( GLcontext *ctx, /* Read stencil spans and pixels */ -static void TAG(ReadStencilSpan)( GLcontext *ctx, +static void TAG(ReadStencilSpan)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, void *values) @@ -190,7 +190,7 @@ static void TAG(ReadStencilSpan)( GLcontext *ctx, HW_READ_UNLOCK(); } -static void TAG(ReadStencilPixels)( GLcontext *ctx, +static void TAG(ReadStencilPixels)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], void *values ) diff --git a/src/mesa/drivers/dri/common/texmem.c b/src/mesa/drivers/dri/common/texmem.c index 895139b55b..8eec07d5bc 100644 --- a/src/mesa/drivers/dri/common/texmem.c +++ b/src/mesa/drivers/dri/common/texmem.c @@ -89,7 +89,7 @@ driLog2( GLuint n ) */ GLboolean -driIsTextureResident( GLcontext * ctx, +driIsTextureResident( struct gl_context * ctx, struct gl_texture_object * texObj ) { driTextureObject * t; @@ -1047,7 +1047,7 @@ driCalculateMaxTextureLevels( driTexHeap * const * heaps, * \param targets Bit-mask of value texture targets */ -void driInitTextureObjects( GLcontext *ctx, driTextureObject * swapped, +void driInitTextureObjects( struct gl_context *ctx, driTextureObject * swapped, GLuint targets ) { struct gl_texture_object *texObj; diff --git a/src/mesa/drivers/dri/common/texmem.h b/src/mesa/drivers/dri/common/texmem.h index 725ba2e119..6dd07b8a1d 100644 --- a/src/mesa/drivers/dri/common/texmem.h +++ b/src/mesa/drivers/dri/common/texmem.h @@ -277,7 +277,7 @@ void driDestroyTextureObject( driTextureObject * t ); int driAllocateTexture( driTexHeap * const * heap_array, unsigned nr_heaps, driTextureObject * t ); -GLboolean driIsTextureResident( GLcontext * ctx, +GLboolean driIsTextureResident( struct gl_context * ctx, struct gl_texture_object * texObj ); driTexHeap * driCreateTextureHeap( unsigned heap_id, void * context, @@ -309,7 +309,7 @@ driSetTextureSwapCounterLocation( driTexHeap * heap, unsigned * counter ); #define DRI_TEXMGR_DO_TEXTURE_CUBE 0x0008 #define DRI_TEXMGR_DO_TEXTURE_RECT 0x0010 -void driInitTextureObjects( GLcontext *ctx, driTextureObject * swapped, +void driInitTextureObjects( struct gl_context *ctx, driTextureObject * swapped, GLuint targets ); GLboolean driValidateTextureHeaps( driTexHeap * const * texture_heaps, diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c index 0dd879abc9..c195c4fd8f 100644 --- a/src/mesa/drivers/dri/common/utils.c +++ b/src/mesa/drivers/dri/common/utils.c @@ -140,6 +140,7 @@ driGetRendererString( char * buffer, const char * hardware_name, +#define need_GL_ARB_copy_buffer #define need_GL_ARB_draw_buffers #define need_GL_ARB_multisample #define need_GL_ARB_texture_compression @@ -164,6 +165,7 @@ driGetRendererString( char * buffer, const char * hardware_name, #include "main/remap_helper.h" static const struct dri_extension all_mesa_extensions[] = { + { "GL_ARB_copy_buffer", GL_ARB_copy_buffer_functions }, { "GL_ARB_draw_buffers", GL_ARB_draw_buffers_functions }, { "GL_ARB_multisample", GL_ARB_multisample_functions }, { "GL_ARB_texture_compression", GL_ARB_texture_compression_functions }, @@ -196,7 +198,7 @@ static const struct dri_extension all_mesa_extensions[] = { * we need to add entry-points (via \c driInitSingleExtension) for those * new functions here. */ -void driInitExtensions( GLcontext * ctx, +void driInitExtensions( struct gl_context * ctx, const struct dri_extension * extensions_to_enable, GLboolean enable_imaging ) { @@ -237,7 +239,7 @@ void driInitExtensions( GLcontext * ctx, * * \sa driInitExtensions, _mesa_enable_extension, _mesa_map_function_array */ -void driInitSingleExtension( GLcontext * ctx, +void driInitSingleExtension( struct gl_context * ctx, const struct dri_extension * ext ) { if ( ext->functions != NULL ) { @@ -335,7 +337,7 @@ driCheckDriDdxDrmVersions2(const char * driver_name, drmActual, drmExpected); } -GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer, +GLboolean driClipRectToFramebuffer( const struct gl_framebuffer *buffer, GLint *x, GLint *y, GLsizei *width, GLsizei *height ) { @@ -369,14 +371,14 @@ GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer, } /** - * Creates a set of \c __GLcontextModes that a driver will expose. + * Creates a set of \c struct gl_config that a driver will expose. * - * A set of \c __GLcontextModes will be created based on the supplied + * A set of \c struct gl_config will be created based on the supplied * parameters. The number of modes processed will be 2 * * \c num_depth_stencil_bits * \c num_db_modes. * * For the most part, data is just copied from \c depth_bits, \c stencil_bits, - * \c db_modes, and \c visType into each \c __GLcontextModes element. + * \c db_modes, and \c visType into each \c struct gl_config element. * However, the meanings of \c fb_format and \c fb_type require further * explanation. The \c fb_format specifies which color components are in * each pixel and what the default order is. For example, \c GL_RGB specifies @@ -389,7 +391,7 @@ GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer, * * One sublte issue is the combination of \c GL_RGB or \c GL_BGR and either * of the \c GL_UNSIGNED_INT_8_8_8_8 modes. The resulting mask values in the - * \c __GLcontextModes structure is \b identical to the \c GL_RGBA or + * \c struct gl_config structure is \b identical to the \c GL_RGBA or * \c GL_BGRA case, except the \c alphaMask is zero. This means that, as * far as this routine is concerned, \c GL_RGB with \c GL_UNSIGNED_INT_8_8_8_8 * still uses 32-bits. @@ -397,7 +399,7 @@ GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer, * If in doubt, look at the tables used in the function. * * \param ptr_to_modes Pointer to a pointer to a linked list of - * \c __GLcontextModes. Upon completion, a pointer to + * \c struct gl_config. Upon completion, a pointer to * the next element to be process will be stored here. * If the function fails and returns \c GL_FALSE, this * value will be unmodified, but some elements in the @@ -503,7 +505,7 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, const uint32_t * masks; int index; __DRIconfig **configs, **c; - __GLcontextModes *modes; + struct gl_config *modes; unsigned i, j, k, h; unsigned num_modes; unsigned num_accum_bits = (enable_accum) ? 2 : 1; @@ -618,9 +620,6 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, modes->transparentBlue = GLX_DONT_CARE; modes->transparentAlpha = GLX_DONT_CARE; modes->transparentIndex = GLX_DONT_CARE; - modes->visualType = GLX_DONT_CARE; - modes->renderType = GLX_RGBA_BIT; - modes->drawableType = GLX_WINDOW_BIT; modes->rgbMode = GL_TRUE; if ( db_modes[i] == GLX_NONE ) { @@ -686,7 +685,7 @@ __DRIconfig **driConcatConfigs(__DRIconfig **a, } #define __ATTRIB(attrib, field) \ - { attrib, offsetof(__GLcontextModes, field) } + { attrib, offsetof(struct gl_config, field) } static const struct { unsigned int attrib, offset; } attribMap[] = { __ATTRIB(__DRI_ATTRIB_BUFFER_SIZE, rgbBits), diff --git a/src/mesa/drivers/dri/common/utils.h b/src/mesa/drivers/dri/common/utils.h index de6070c398..6349fb4b95 100644 --- a/src/mesa/drivers/dri/common/utils.h +++ b/src/mesa/drivers/dri/common/utils.h @@ -78,10 +78,10 @@ extern unsigned driParseDebugString( const char * debug, extern unsigned driGetRendererString( char * buffer, const char * hardware_name, const char * driver_date, GLuint agp_mode ); -extern void driInitExtensions( GLcontext * ctx, +extern void driInitExtensions( struct gl_context * ctx, const struct dri_extension * card_extensions, GLboolean enable_imaging ); -extern void driInitSingleExtension( GLcontext * ctx, +extern void driInitSingleExtension( struct gl_context * ctx, const struct dri_extension * ext ); extern GLboolean driCheckDriDdxDrmVersions2(const char * driver_name, @@ -94,12 +94,12 @@ extern GLboolean driCheckDriDdxDrmVersions3(const char * driver_name, const __DRIversion * ddxActual, const __DRIutilversion2 * ddxExpected, const __DRIversion * drmActual, const __DRIversion * drmExpected); -extern GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer, +extern GLboolean driClipRectToFramebuffer( const struct gl_framebuffer *buffer, GLint *x, GLint *y, GLsizei *width, GLsizei *height ); struct __DRIconfigRec { - __GLcontextModes modes; + struct gl_config modes; }; extern __DRIconfig ** diff --git a/src/mesa/drivers/dri/common/vblank.c b/src/mesa/drivers/dri/common/vblank.c index 49b22a2dc7..cb98dd0b3a 100644 --- a/src/mesa/drivers/dri/common/vblank.c +++ b/src/mesa/drivers/dri/common/vblank.c @@ -241,7 +241,7 @@ GLuint driGetDefaultVBlankFlags( const driOptionCache *optionCache ) * the first time the \c drmWaitVBlank fails. If \c drmWaitVBlank is * successful, \c vbl_seq will be set the sequence value in the reply. * - * \param vbl Pointer to drmVBlank packet desribing how to wait. + * \param vbl Pointer to drmVBlank packet describing how to wait. * \param vbl_seq Location to store the current refresh counter. * \param fd File descriptor use to call into the DRM. * \return Zero on success or -1 on failure. diff --git a/src/mesa/drivers/dri/common/vblank.h b/src/mesa/drivers/dri/common/vblank.h index 29d1ad8003..067fb5ed8d 100644 --- a/src/mesa/drivers/dri/common/vblank.h +++ b/src/mesa/drivers/dri/common/vblank.h @@ -61,10 +61,6 @@ extern int driWaitForVBlank( __DRIdrawable *priv, #include <unistd.h> /* for usleep() */ #include <sched.h> /* for sched_yield() */ -#ifdef linux -#include <sched.h> /* for sched_yield() */ -#endif - #define DO_USLEEP(nr) \ do { \ if (0) fprintf(stderr, "%s: usleep for %u\n", __FUNCTION__, nr ); \ diff --git a/src/mesa/drivers/dri/common/xmlconfig.c b/src/mesa/drivers/dri/common/xmlconfig.c index 738b1ae97f..0312c07243 100644 --- a/src/mesa/drivers/dri/common/xmlconfig.c +++ b/src/mesa/drivers/dri/common/xmlconfig.c @@ -56,6 +56,9 @@ extern char *program_invocation_name, *program_invocation_short_name; #elif defined(__NetBSD__) && defined(__NetBSD_Version) && (__NetBSD_Version >= 106000100) # include <stdlib.h> # define GET_PROGRAM_NAME() getprogname() +#elif defined(__APPLE__) +# include <stdlib.h> +# define GET_PROGRAM_NAME() getprogname() #elif defined(__sun) /* Solaris has getexecname() which returns the full path - return just the basename to match BSD getprogname() */ @@ -206,7 +209,7 @@ static GLint strToI (const XML_Char *string, const XML_Char **tail, int base) { * * Works similar to strtod. Leading space is NOT skipped. The input * number may have an optional sign. '.' is interpreted as decimal - * point and may occor at most once. Optionally the number may end in + * point and may occur at most once. Optionally the number may end in * [eE]<exponent>, where <exponent> is an integer as recognized by * strToI. In that case the result is number * 10^exponent. After * returning tail points to the first character that is not part of @@ -728,7 +731,7 @@ static void parseDeviceAttr (struct OptConfData *data, const XML_Char **attr) { for (i = 0; attr[i]; i += 2) { if (!strcmp (attr[i], "driver")) driver = attr[i+1]; else if (!strcmp (attr[i], "screen")) screen = attr[i+1]; - else XML_WARNING("unkown device attribute: %s.", attr[i]); + else XML_WARNING("unknown device attribute: %s.", attr[i]); } if (driver && strcmp (driver, data->driverName)) data->ignoringDevice = data->inDevice; @@ -748,7 +751,7 @@ static void parseAppAttr (struct OptConfData *data, const XML_Char **attr) { for (i = 0; attr[i]; i += 2) { if (!strcmp (attr[i], "name")) name = attr[i+1]; else if (!strcmp (attr[i], "executable")) exec = attr[i+1]; - else XML_WARNING("unkown application attribute: %s.", attr[i]); + else XML_WARNING("unknown application attribute: %s.", attr[i]); } if (exec && strcmp (exec, data->execName)) data->ignoringApp = data->inApp; @@ -761,7 +764,7 @@ static void parseOptConfAttr (struct OptConfData *data, const XML_Char **attr) { for (i = 0; attr[i]; i += 2) { if (!strcmp (attr[i], "name")) name = attr[i+1]; else if (!strcmp (attr[i], "value")) value = attr[i+1]; - else XML_WARNING("unkown option attribute: %s.", attr[i]); + else XML_WARNING("unknown option attribute: %s.", attr[i]); } if (!name) XML_WARNING1 ("name attribute missing in option."); if (!value) XML_WARNING1 ("value attribute missing in option."); diff --git a/src/mesa/drivers/dri/i810/i810context.c b/src/mesa/drivers/dri/i810/i810context.c index 49f3ee88a6..dc58e91e8c 100644 --- a/src/mesa/drivers/dri/i810/i810context.c +++ b/src/mesa/drivers/dri/i810/i810context.c @@ -69,7 +69,7 @@ const GLuint __driNConfigOptions = 0; #define DRIVER_DATE "20050821" -static const GLubyte *i810GetString( GLcontext *ctx, GLenum name ) +static const GLubyte *i810GetString( struct gl_context *ctx, GLenum name ) { static char buffer[128]; @@ -96,7 +96,7 @@ static const GLubyte *i810GetString( GLcontext *ctx, GLenum name ) } } -static void i810BufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height) +static void i810BufferSize(struct gl_framebuffer *buffer, GLuint *width, GLuint *height) { GET_CURRENT_CONTEXT(ctx); i810ContextPtr imesa = I810_CONTEXT(ctx); @@ -127,7 +127,6 @@ static const struct dri_extension card_extensions[] = { "GL_EXT_texture_rectangle", NULL }, { "GL_MESA_ycbcr_texture", NULL }, { "GL_NV_blend_square", NULL }, - { "GL_SGIS_generate_mipmap", NULL }, { NULL, NULL } }; @@ -167,11 +166,11 @@ static const struct dri_debug_control debug_control[] = GLboolean i810CreateContext( gl_api api, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, __DRIcontext *driContextPriv, void *sharedContextPrivate ) { - GLcontext *ctx, *shareCtx; + struct gl_context *ctx, *shareCtx; i810ContextPtr imesa; __DRIscreen *sPriv = driContextPriv->driScreenPriv; i810ScreenPrivate *i810Screen = (i810ScreenPrivate *)sPriv->private; @@ -269,7 +268,7 @@ i810CreateContext( gl_api api, ctx->Const.PointSizeGranularity = 1.0; /* reinitialize the context point state. - * It depend on constants in __GLcontextRec::Const + * It depend on constants in __struct gl_contextRec::Const */ _mesa_init_point(ctx); @@ -454,8 +453,8 @@ i810MakeCurrent(__DRIcontext *driContextPriv, imesa->driDrawable = driDrawPriv; _mesa_make_current(imesa->glCtx, - (GLframebuffer *) driDrawPriv->driverPrivate, - (GLframebuffer *) driReadPriv->driverPrivate); + (struct gl_framebuffer *) driDrawPriv->driverPrivate, + (struct gl_framebuffer *) driReadPriv->driverPrivate); /* Are these necessary? */ @@ -471,7 +470,7 @@ i810MakeCurrent(__DRIcontext *driContextPriv, static void i810UpdatePageFlipping( i810ContextPtr imesa ) { - GLcontext *ctx = imesa->glCtx; + struct gl_context *ctx = imesa->glCtx; int front = 0; /* Determine current color drawing buffer */ @@ -553,7 +552,7 @@ i810SwapBuffers( __DRIdrawable *dPriv ) { if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) { i810ContextPtr imesa; - GLcontext *ctx; + struct gl_context *ctx; imesa = (i810ContextPtr) dPriv->driContextPriv->driverPrivate; ctx = imesa->glCtx; if (ctx->Visual.doubleBufferMode) { diff --git a/src/mesa/drivers/dri/i810/i810context.h b/src/mesa/drivers/dri/i810/i810context.h index 19529db020..93c7eda7b3 100644 --- a/src/mesa/drivers/dri/i810/i810context.h +++ b/src/mesa/drivers/dri/i810/i810context.h @@ -79,7 +79,7 @@ typedef void (*i810_point_func)( i810ContextPtr, i810Vertex * ); struct i810_context_t { GLint refcount; - GLcontext *glCtx; + struct gl_context *glCtx; /* Texture object bookkeeping */ @@ -146,7 +146,7 @@ struct i810_context_t { /* DRI stuff */ GLuint needClip; - GLframebuffer *glBuffer; + struct gl_framebuffer *glBuffer; GLboolean doPageFlip; /* These refer to the current draw (front vs. back) buffer: diff --git a/src/mesa/drivers/dri/i810/i810ioctl.c b/src/mesa/drivers/dri/i810/i810ioctl.c index c631543d93..4b004d54c6 100644 --- a/src/mesa/drivers/dri/i810/i810ioctl.c +++ b/src/mesa/drivers/dri/i810/i810ioctl.c @@ -47,7 +47,7 @@ static drmBufPtr i810_get_buffer_ioctl( i810ContextPtr imesa ) #define DEPTH_SCALE ((1<<16)-1) -static void i810Clear( GLcontext *ctx, GLbitfield mask ) +static void i810Clear( struct gl_context *ctx, GLbitfield mask ) { i810ContextPtr imesa = I810_CONTEXT( ctx ); __DRIdrawable *dPriv = imesa->driDrawable; @@ -499,13 +499,13 @@ int i810_check_copy(int fd) return(drmCommandNone(fd, DRM_I810_DOCOPY)); } -static void i810Flush( GLcontext *ctx ) +static void i810Flush( struct gl_context *ctx ) { i810ContextPtr imesa = I810_CONTEXT( ctx ); I810_FIREVERTICES( imesa ); } -static void i810Finish( GLcontext *ctx ) +static void i810Finish( struct gl_context *ctx ) { i810ContextPtr imesa = I810_CONTEXT( ctx ); i810DmaFinish( imesa ); diff --git a/src/mesa/drivers/dri/i810/i810render.c b/src/mesa/drivers/dri/i810/i810render.c index 205f0cebc1..45f0954bbe 100644 --- a/src/mesa/drivers/dri/i810/i810render.c +++ b/src/mesa/drivers/dri/i810/i810render.c @@ -124,7 +124,7 @@ static const GLenum reduced_prim[GL_POLYGON+1] = { /**********************************************************************/ -static GLboolean i810_run_render( GLcontext *ctx, +static GLboolean i810_run_render( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { i810ContextPtr imesa = I810_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index 56708c97cb..fc56b61b4e 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -55,7 +55,7 @@ i810FillInModes( __DRIscreen *psp, unsigned stencil_bits, GLboolean have_back_buffer ) { __DRIconfig **configs; - __GLcontextModes * m; + struct gl_config * m; unsigned depth_buffer_factor; unsigned back_buffer_factor; unsigned i; @@ -272,7 +272,7 @@ i810DestroyScreen(__DRIscreen *sPriv) static GLboolean i810CreateBuffer( __DRIscreen *driScrnPriv, __DRIdrawable *driDrawPriv, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, GLboolean isPixmap ) { i810ScreenPrivate *screen = (i810ScreenPrivate *) driScrnPriv->private; @@ -333,7 +333,7 @@ i810CreateBuffer( __DRIscreen *driScrnPriv, static void i810DestroyBuffer(__DRIdrawable *driDrawPriv) { - _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL); + _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL); } const struct __DriverAPIRec driDriverAPI = { diff --git a/src/mesa/drivers/dri/i810/i810screen.h b/src/mesa/drivers/dri/i810/i810screen.h index fe6db7e6e1..25c1072ce0 100644 --- a/src/mesa/drivers/dri/i810/i810screen.h +++ b/src/mesa/drivers/dri/i810/i810screen.h @@ -79,7 +79,7 @@ typedef struct { extern GLboolean i810CreateContext( gl_api api, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, __DRIcontext *driContextPriv, void *sharedContextPrivate ); diff --git a/src/mesa/drivers/dri/i810/i810span.c b/src/mesa/drivers/dri/i810/i810span.c index 6576f6745e..dddab8bb51 100644 --- a/src/mesa/drivers/dri/i810/i810span.c +++ b/src/mesa/drivers/dri/i810/i810span.c @@ -81,7 +81,7 @@ do { \ /* Move locking out to get reasonable span performance. */ -void i810SpanRenderStart( GLcontext *ctx ) +void i810SpanRenderStart( struct gl_context *ctx ) { i810ContextPtr imesa = I810_CONTEXT(ctx); I810_FIREVERTICES(imesa); @@ -89,14 +89,14 @@ void i810SpanRenderStart( GLcontext *ctx ) i810RegetLockQuiescent( imesa ); } -void i810SpanRenderFinish( GLcontext *ctx ) +void i810SpanRenderFinish( struct gl_context *ctx ) { i810ContextPtr imesa = I810_CONTEXT( ctx ); _swrast_flush( ctx ); UNLOCK_HARDWARE( imesa ); } -void i810InitSpanFuncs( GLcontext *ctx ) +void i810InitSpanFuncs( struct gl_context *ctx ) { struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx); swdd->SpanRenderStart = i810SpanRenderStart; @@ -109,7 +109,7 @@ void i810InitSpanFuncs( GLcontext *ctx ) * Plug in the Get/Put routines for the given driRenderbuffer. */ void -i810SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis) +i810SetSpanFunctions(driRenderbuffer *drb, const struct gl_config *vis) { if (drb->Base.InternalFormat == GL_RGBA) { /* always 565 RGB */ diff --git a/src/mesa/drivers/dri/i810/i810span.h b/src/mesa/drivers/dri/i810/i810span.h index 9aed253bd5..184a37a103 100644 --- a/src/mesa/drivers/dri/i810/i810span.h +++ b/src/mesa/drivers/dri/i810/i810span.h @@ -3,12 +3,12 @@ #include "drirenderbuffer.h" -extern void i810InitSpanFuncs( GLcontext *ctx ); +extern void i810InitSpanFuncs( struct gl_context *ctx ); -extern void i810SpanRenderFinish( GLcontext *ctx ); -extern void i810SpanRenderStart( GLcontext *ctx ); +extern void i810SpanRenderFinish( struct gl_context *ctx ); +extern void i810SpanRenderStart( struct gl_context *ctx ); extern void -i810SetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis); +i810SetSpanFunctions(driRenderbuffer *rb, const struct gl_config *vis); #endif diff --git a/src/mesa/drivers/dri/i810/i810state.c b/src/mesa/drivers/dri/i810/i810state.c index 0c68e120b0..7c3fbb1424 100644 --- a/src/mesa/drivers/dri/i810/i810state.c +++ b/src/mesa/drivers/dri/i810/i810state.c @@ -43,7 +43,7 @@ static INLINE GLuint i810PackColor(GLuint format, } -static void i810AlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref) +static void i810AlphaFunc(struct gl_context *ctx, GLenum func, GLfloat ref) { i810ContextPtr imesa = I810_CONTEXT(ctx); GLuint a = (ZA_UPDATE_ALPHAFUNC|ZA_UPDATE_ALPHAREF); @@ -70,7 +70,7 @@ static void i810AlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref) imesa->Setup[I810_CTXREG_ZA] |= a; } -static void i810BlendEquationSeparate(GLcontext *ctx, +static void i810BlendEquationSeparate(struct gl_context *ctx, GLenum modeRGB, GLenum modeA) { assert( modeRGB == modeA ); @@ -87,7 +87,7 @@ static void i810BlendEquationSeparate(GLcontext *ctx, ctx->Color.LogicOp != GL_COPY)); } -static void i810BlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB, +static void i810BlendFuncSeparate( struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) { @@ -156,7 +156,7 @@ static void i810BlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB, -static void i810DepthFunc(GLcontext *ctx, GLenum func) +static void i810DepthFunc(struct gl_context *ctx, GLenum func) { i810ContextPtr imesa = I810_CONTEXT(ctx); int zmode; @@ -178,7 +178,7 @@ static void i810DepthFunc(GLcontext *ctx, GLenum func) imesa->Setup[I810_CTXREG_LCS] |= zmode; } -static void i810DepthMask(GLcontext *ctx, GLboolean flag) +static void i810DepthMask(struct gl_context *ctx, GLboolean flag) { i810ContextPtr imesa = I810_CONTEXT(ctx); I810_STATECHANGE(imesa, I810_UPLOAD_CTX); @@ -196,7 +196,7 @@ static void i810DepthMask(GLcontext *ctx, GLboolean flag) * The i810 supports a 4x4 stipple natively, GL wants 32x32. * Fortunately stipple is usually a repeating pattern. */ -static void i810PolygonStipple( GLcontext *ctx, const GLubyte *mask ) +static void i810PolygonStipple( struct gl_context *ctx, const GLubyte *mask ) { i810ContextPtr imesa = I810_CONTEXT(ctx); const GLubyte *m = mask; @@ -250,7 +250,7 @@ static void i810PolygonStipple( GLcontext *ctx, const GLubyte *mask ) */ -static void i810Scissor( GLcontext *ctx, GLint x, GLint y, +static void i810Scissor( struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) { i810ContextPtr imesa = I810_CONTEXT(ctx); @@ -267,7 +267,7 @@ static void i810Scissor( GLcontext *ctx, GLint x, GLint y, } -static void i810LogicOp( GLcontext *ctx, GLenum opcode ) +static void i810LogicOp( struct gl_context *ctx, GLenum opcode ) { i810ContextPtr imesa = I810_CONTEXT(ctx); FALLBACK( imesa, I810_FALLBACK_LOGICOP, @@ -276,14 +276,14 @@ static void i810LogicOp( GLcontext *ctx, GLenum opcode ) /* Fallback to swrast for select and feedback. */ -static void i810RenderMode( GLcontext *ctx, GLenum mode ) +static void i810RenderMode( struct gl_context *ctx, GLenum mode ) { i810ContextPtr imesa = I810_CONTEXT(ctx); FALLBACK( imesa, I810_FALLBACK_RENDERMODE, (mode != GL_RENDER) ); } -void i810DrawBuffer(GLcontext *ctx, GLenum mode ) +void i810DrawBuffer(struct gl_context *ctx, GLenum mode ) { i810ContextPtr imesa = I810_CONTEXT(ctx); int front = 0; @@ -328,13 +328,13 @@ void i810DrawBuffer(GLcontext *ctx, GLenum mode ) } -static void i810ReadBuffer(GLcontext *ctx, GLenum mode ) +static void i810ReadBuffer(struct gl_context *ctx, GLenum mode ) { /* XXX anything? */ } -static void i810ClearColor(GLcontext *ctx, const GLfloat color[4] ) +static void i810ClearColor(struct gl_context *ctx, const GLfloat color[4] ) { i810ContextPtr imesa = I810_CONTEXT(ctx); GLubyte c[4]; @@ -351,7 +351,7 @@ static void i810ClearColor(GLcontext *ctx, const GLfloat color[4] ) * Culling - the i810 isn't quite as clean here as the rest of * its interfaces, but it's not bad. */ -static void i810CullFaceFrontFace(GLcontext *ctx, GLenum unused) +static void i810CullFaceFrontFace(struct gl_context *ctx, GLenum unused) { i810ContextPtr imesa = I810_CONTEXT(ctx); GLuint mode = LCS_CULL_BOTH; @@ -375,7 +375,7 @@ static void i810CullFaceFrontFace(GLcontext *ctx, GLenum unused) } -static void i810LineWidth( GLcontext *ctx, GLfloat widthf ) +static void i810LineWidth( struct gl_context *ctx, GLfloat widthf ) { i810ContextPtr imesa = I810_CONTEXT( ctx ); /* AA, non-AA limits are same */ @@ -394,7 +394,7 @@ static void i810LineWidth( GLcontext *ctx, GLfloat widthf ) } } -static void i810PointSize( GLcontext *ctx, GLfloat sz ) +static void i810PointSize( struct gl_context *ctx, GLfloat sz ) { i810ContextPtr imesa = I810_CONTEXT( ctx ); /* AA, non-AA limits are same */ @@ -417,7 +417,7 @@ static void i810PointSize( GLcontext *ctx, GLfloat sz ) * Color masks */ -static void i810ColorMask(GLcontext *ctx, +static void i810ColorMask(struct gl_context *ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) { @@ -444,7 +444,7 @@ static void i810ColorMask(GLcontext *ctx, /* Seperate specular not fully implemented on the i810. */ -static void i810LightModelfv(GLcontext *ctx, GLenum pname, +static void i810LightModelfv(struct gl_context *ctx, GLenum pname, const GLfloat *param) { if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) @@ -458,7 +458,7 @@ static void i810LightModelfv(GLcontext *ctx, GLenum pname, /* But the 815 has it... */ -static void i810LightModelfv_i815(GLcontext *ctx, GLenum pname, +static void i810LightModelfv_i815(struct gl_context *ctx, GLenum pname, const GLfloat *param) { if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) @@ -475,7 +475,7 @@ static void i810LightModelfv_i815(GLcontext *ctx, GLenum pname, /* In Mesa 3.5 we can reliably do native flatshading. */ -static void i810ShadeModel(GLcontext *ctx, GLenum mode) +static void i810ShadeModel(struct gl_context *ctx, GLenum mode) { i810ContextPtr imesa = I810_CONTEXT(ctx); I810_STATECHANGE(imesa, I810_UPLOAD_CTX); @@ -490,7 +490,7 @@ static void i810ShadeModel(GLcontext *ctx, GLenum mode) /* ============================================================= * Fog */ -static void i810Fogfv(GLcontext *ctx, GLenum pname, const GLfloat *param) +static void i810Fogfv(struct gl_context *ctx, GLenum pname, const GLfloat *param) { i810ContextPtr imesa = I810_CONTEXT(ctx); @@ -508,7 +508,7 @@ static void i810Fogfv(GLcontext *ctx, GLenum pname, const GLfloat *param) /* ============================================================= */ -static void i810Enable(GLcontext *ctx, GLenum cap, GLboolean state) +static void i810Enable(struct gl_context *ctx, GLenum cap, GLboolean state) { i810ContextPtr imesa = I810_CONTEXT(ctx); @@ -672,7 +672,7 @@ void i810EmitDrawingRectangle( i810ContextPtr imesa ) -static void i810CalcViewport( GLcontext *ctx ) +static void i810CalcViewport( struct gl_context *ctx ) { i810ContextPtr imesa = I810_CONTEXT(ctx); const GLfloat *v = ctx->Viewport._WindowMap.m; @@ -689,14 +689,14 @@ static void i810CalcViewport( GLcontext *ctx ) m[MAT_TZ] = v[MAT_TZ] * (1.0 / 0xffff); } -static void i810Viewport( GLcontext *ctx, +static void i810Viewport( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) { i810CalcViewport( ctx ); } -static void i810DepthRange( GLcontext *ctx, +static void i810DepthRange( struct gl_context *ctx, GLclampd nearval, GLclampd farval ) { i810CalcViewport( ctx ); @@ -718,7 +718,7 @@ void i810PrintDirty( const char *msg, GLuint state ) -void i810InitState( GLcontext *ctx ) +void i810InitState( struct gl_context *ctx ) { i810ContextPtr imesa = I810_CONTEXT(ctx); i810ScreenPrivate *i810Screen = imesa->i810Screen; @@ -953,7 +953,7 @@ void i810InitState( GLcontext *ctx ) } -static void i810InvalidateState( GLcontext *ctx, GLuint new_state ) +static void i810InvalidateState( struct gl_context *ctx, GLuint new_state ) { _swrast_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); @@ -963,7 +963,7 @@ static void i810InvalidateState( GLcontext *ctx, GLuint new_state ) } -void i810InitStateFuncs(GLcontext *ctx) +void i810InitStateFuncs(struct gl_context *ctx) { /* Callbacks for internal Mesa events. */ diff --git a/src/mesa/drivers/dri/i810/i810state.h b/src/mesa/drivers/dri/i810/i810state.h index 118b075491..96af123765 100644 --- a/src/mesa/drivers/dri/i810/i810state.h +++ b/src/mesa/drivers/dri/i810/i810state.h @@ -3,10 +3,10 @@ #include "i810context.h" -extern void i810InitState( GLcontext *ctx ); -extern void i810InitStateFuncs( GLcontext *ctx ); +extern void i810InitState( struct gl_context *ctx ); +extern void i810InitStateFuncs( struct gl_context *ctx ); extern void i810PrintDirty( const char *msg, GLuint state ); -extern void i810DrawBuffer(GLcontext *ctx, GLenum mode ); +extern void i810DrawBuffer(struct gl_context *ctx, GLenum mode ); extern void i810Fallback( i810ContextPtr imesa, GLuint bit, GLboolean mode ); #define FALLBACK( imesa, bit, mode ) i810Fallback( imesa, bit, mode ) diff --git a/src/mesa/drivers/dri/i810/i810tex.c b/src/mesa/drivers/dri/i810/i810tex.c index 2ccb9562e9..49364aeb22 100644 --- a/src/mesa/drivers/dri/i810/i810tex.c +++ b/src/mesa/drivers/dri/i810/i810tex.c @@ -31,7 +31,6 @@ #include "main/teximage.h" #include "main/texobj.h" #include "main/colormac.h" -#include "main/texobj.h" #include "main/mm.h" #include "texmem.h" @@ -167,7 +166,7 @@ i810SetTexBorderColor( i810TextureObjectPtr t, const GLfloat color[4] ) static i810TextureObjectPtr -i810AllocTexObj( GLcontext *ctx, struct gl_texture_object *texObj ) +i810AllocTexObj( struct gl_context *ctx, struct gl_texture_object *texObj ) { i810TextureObjectPtr t; i810ContextPtr imesa = I810_CONTEXT(ctx); @@ -215,7 +214,7 @@ i810AllocTexObj( GLcontext *ctx, struct gl_texture_object *texObj ) } -static void i810TexParameter( GLcontext *ctx, GLenum target, +static void i810TexParameter( struct gl_context *ctx, GLenum target, struct gl_texture_object *tObj, GLenum pname, const GLfloat *params ) { @@ -286,7 +285,7 @@ static void i810TexParameter( GLcontext *ctx, GLenum target, * Determine whether or not \c param can be used instead of * \c texUnit->EnvColor in the \c GL_TEXTURE_ENV_COLOR case. */ -static void i810TexEnv( GLcontext *ctx, GLenum target, +static void i810TexEnv( struct gl_context *ctx, GLenum target, GLenum pname, const GLfloat *param ) { i810ContextPtr imesa = I810_CONTEXT( ctx ); @@ -334,7 +333,7 @@ static void i810TexEnv( GLcontext *ctx, GLenum target, #if 0 -static void i810TexImage1D( GLcontext *ctx, GLenum target, GLint level, +static void i810TexImage1D( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, @@ -349,7 +348,7 @@ static void i810TexImage1D( GLcontext *ctx, GLenum target, GLint level, } } -static void i810TexSubImage1D( GLcontext *ctx, +static void i810TexSubImage1D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, @@ -364,7 +363,7 @@ static void i810TexSubImage1D( GLcontext *ctx, #endif -static void i810TexImage2D( GLcontext *ctx, GLenum target, GLint level, +static void i810TexImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -389,7 +388,7 @@ static void i810TexImage2D( GLcontext *ctx, GLenum target, GLint level, pixels, packing, texObj, texImage ); } -static void i810TexSubImage2D( GLcontext *ctx, +static void i810TexSubImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -411,14 +410,14 @@ static void i810TexSubImage2D( GLcontext *ctx, } -static void i810BindTexture( GLcontext *ctx, GLenum target, +static void i810BindTexture( struct gl_context *ctx, GLenum target, struct gl_texture_object *tObj ) { assert( (target != GL_TEXTURE_2D) || (tObj->DriverData != NULL) ); } -static void i810DeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj ) +static void i810DeleteTexture( struct gl_context *ctx, struct gl_texture_object *tObj ) { driTextureObject * t = (driTextureObject *) tObj->DriverData; if (t) { @@ -438,7 +437,7 @@ static void i810DeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj ) * makes this routine pretty simple. */ static gl_format -i810ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, +i810ChooseTextureFormat( struct gl_context *ctx, GLint internalFormat, GLenum format, GLenum type ) { switch ( internalFormat ) { @@ -525,7 +524,7 @@ i810ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, * texture object from the core mesa gl_texture_object. Not done at this time. */ static struct gl_texture_object * -i810NewTextureObject( GLcontext *ctx, GLuint name, GLenum target ) +i810NewTextureObject( struct gl_context *ctx, GLuint name, GLenum target ) { struct gl_texture_object *obj; obj = _mesa_new_texture_object(ctx, name, target); diff --git a/src/mesa/drivers/dri/i810/i810tex.h b/src/mesa/drivers/dri/i810/i810tex.h index 28958dcb4b..b396848b79 100644 --- a/src/mesa/drivers/dri/i810/i810tex.h +++ b/src/mesa/drivers/dri/i810/i810tex.h @@ -68,7 +68,7 @@ struct i810_texture_object_t { }; -void i810UpdateTextureState( GLcontext *ctx ); +void i810UpdateTextureState( struct gl_context *ctx ); void i810InitTextureFuncs( struct dd_function_table *functions ); void i810DestroyTexObj( i810ContextPtr imesa, i810TextureObjectPtr t ); diff --git a/src/mesa/drivers/dri/i810/i810texstate.c b/src/mesa/drivers/dri/i810/i810texstate.c index bff28c11c8..5b505e71a4 100644 --- a/src/mesa/drivers/dri/i810/i810texstate.c +++ b/src/mesa/drivers/dri/i810/i810texstate.c @@ -191,7 +191,7 @@ static const unsigned operand_modifiers[] = { * a reasonable place to make note of it. */ static GLboolean -i810UpdateTexEnvCombine( GLcontext *ctx, GLuint unit, +i810UpdateTexEnvCombine( struct gl_context *ctx, GLuint unit, int * color_stage, int * alpha_stage ) { i810ContextPtr imesa = I810_CONTEXT(ctx); @@ -533,7 +533,7 @@ i810UpdateTexEnvCombine( GLcontext *ctx, GLuint unit, return GL_TRUE; } -static GLboolean enable_tex_common( GLcontext *ctx, GLuint unit ) +static GLboolean enable_tex_common( struct gl_context *ctx, GLuint unit ) { i810ContextPtr imesa = I810_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; @@ -570,7 +570,7 @@ static GLboolean enable_tex_common( GLcontext *ctx, GLuint unit ) return GL_TRUE; } -static GLboolean enable_tex_rect( GLcontext *ctx, GLuint unit ) +static GLboolean enable_tex_rect( struct gl_context *ctx, GLuint unit ) { i810ContextPtr imesa = I810_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; @@ -590,7 +590,7 @@ static GLboolean enable_tex_rect( GLcontext *ctx, GLuint unit ) return GL_TRUE; } -static GLboolean enable_tex_2d( GLcontext *ctx, GLuint unit ) +static GLboolean enable_tex_2d( struct gl_context *ctx, GLuint unit ) { i810ContextPtr imesa = I810_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; @@ -610,7 +610,7 @@ static GLboolean enable_tex_2d( GLcontext *ctx, GLuint unit ) return GL_TRUE; } -static void disable_tex( GLcontext *ctx, GLuint unit ) +static void disable_tex( struct gl_context *ctx, GLuint unit ) { i810ContextPtr imesa = I810_CONTEXT(ctx); @@ -627,7 +627,7 @@ static void disable_tex( GLcontext *ctx, GLuint unit ) * 1D textures should be supported! Just use a 2D texture with the second * texture coordinate value fixed at 0.0. */ -static void i810UpdateTexUnit( GLcontext *ctx, GLuint unit, +static void i810UpdateTexUnit( struct gl_context *ctx, GLuint unit, int * next_color_stage, int * next_alpha_stage ) { i810ContextPtr imesa = I810_CONTEXT(ctx); @@ -664,7 +664,7 @@ static void i810UpdateTexUnit( GLcontext *ctx, GLuint unit, } -void i810UpdateTextureState( GLcontext *ctx ) +void i810UpdateTextureState( struct gl_context *ctx ) { static const unsigned color_pass[3] = { GFX_OP_MAP_COLOR_STAGES | MC_STAGE_0 | MC_UPDATE_DEST | MC_DEST_CURRENT diff --git a/src/mesa/drivers/dri/i810/i810tris.c b/src/mesa/drivers/dri/i810/i810tris.c index 1492f711c9..ec22a3deb3 100644 --- a/src/mesa/drivers/dri/i810/i810tris.c +++ b/src/mesa/drivers/dri/i810/i810tris.c @@ -49,7 +49,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "i810vb.h" #include "i810ioctl.h" -static void i810RenderPrimitive( GLcontext *ctx, GLenum prim ); +static void i810RenderPrimitive( struct gl_context *ctx, GLenum prim ); /*********************************************************************** * Emit primitives as inline vertices * @@ -407,7 +407,7 @@ i810_fallback_tri( i810ContextPtr imesa, i810Vertex *v1, i810Vertex *v2 ) { - GLcontext *ctx = imesa->glCtx; + struct gl_context *ctx = imesa->glCtx; SWvertex v[3]; i810_translate_vertex( ctx, v0, &v[0] ); i810_translate_vertex( ctx, v1, &v[1] ); @@ -421,7 +421,7 @@ i810_fallback_line( i810ContextPtr imesa, i810Vertex *v0, i810Vertex *v1 ) { - GLcontext *ctx = imesa->glCtx; + struct gl_context *ctx = imesa->glCtx; SWvertex v[2]; i810_translate_vertex( ctx, v0, &v[0] ); i810_translate_vertex( ctx, v1, &v[1] ); @@ -433,7 +433,7 @@ static void i810_fallback_point( i810ContextPtr imesa, i810Vertex *v0 ) { - GLcontext *ctx = imesa->glCtx; + struct gl_context *ctx = imesa->glCtx; SWvertex v[1]; i810_translate_vertex( ctx, v0, &v[0] ); _swrast_Point( ctx, &v[0] ); @@ -478,7 +478,7 @@ i810_fallback_point( i810ContextPtr imesa, -static void i810RenderClippedPoly( GLcontext *ctx, const GLuint *elts, +static void i810RenderClippedPoly( struct gl_context *ctx, const GLuint *elts, GLuint n ) { i810ContextPtr imesa = I810_CONTEXT(ctx); @@ -502,13 +502,13 @@ static void i810RenderClippedPoly( GLcontext *ctx, const GLuint *elts, tnl->Driver.Render.PrimitiveNotify( ctx, prim ); } -static void i810RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) +static void i810RenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->Driver.Render.Line( ctx, ii, jj ); } -static void i810FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, +static void i810FastRenderClippedPoly( struct gl_context *ctx, const GLuint *elts, GLuint n ) { i810ContextPtr imesa = I810_CONTEXT( ctx ); @@ -549,7 +549,7 @@ static void i810FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, DD_TRI_STIPPLE) #define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED) -static void i810ChooseRenderState(GLcontext *ctx) +static void i810ChooseRenderState(struct gl_context *ctx) { TNLcontext *tnl = TNL_CONTEXT(ctx); i810ContextPtr imesa = I810_CONTEXT(ctx); @@ -640,7 +640,7 @@ static const GLenum reduced_prim[GL_POLYGON+1] = { * which renders strips as strips, the equivalent calculations are * performed in i810render.c. */ -static void i810RenderPrimitive( GLcontext *ctx, GLenum prim ) +static void i810RenderPrimitive( struct gl_context *ctx, GLenum prim ) { i810ContextPtr imesa = I810_CONTEXT(ctx); GLuint rprim = reduced_prim[prim]; @@ -656,7 +656,7 @@ static void i810RenderPrimitive( GLcontext *ctx, GLenum prim ) } } -static void i810RunPipeline( GLcontext *ctx ) +static void i810RunPipeline( struct gl_context *ctx ) { i810ContextPtr imesa = I810_CONTEXT(ctx); @@ -678,7 +678,7 @@ static void i810RunPipeline( GLcontext *ctx ) _tnl_run_pipeline( ctx ); } -static void i810RenderStart( GLcontext *ctx ) +static void i810RenderStart( struct gl_context *ctx ) { /* Check for projective textureing. Make sure all texcoord * pointers point to something. (fix in mesa?) @@ -686,7 +686,7 @@ static void i810RenderStart( GLcontext *ctx ) i810CheckTexSizes( ctx ); } -static void i810RenderFinish( GLcontext *ctx ) +static void i810RenderFinish( struct gl_context *ctx ) { if (I810_CONTEXT(ctx)->RenderIndex & I810_FALLBACK_BIT) _swrast_flush( ctx ); @@ -698,7 +698,7 @@ static void i810RenderFinish( GLcontext *ctx ) /* System to flush dma and emit state changes based on the rasterized * primitive. */ -void i810RasterPrimitive( GLcontext *ctx, +void i810RasterPrimitive( struct gl_context *ctx, GLenum rprim, GLuint hwprim ) { @@ -815,7 +815,7 @@ static char *getFallbackString(GLuint bit) void i810Fallback( i810ContextPtr imesa, GLuint bit, GLboolean mode ) { - GLcontext *ctx = imesa->glCtx; + struct gl_context *ctx = imesa->glCtx; TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint oldfallback = imesa->Fallback; @@ -853,7 +853,7 @@ void i810Fallback( i810ContextPtr imesa, GLuint bit, GLboolean mode ) /**********************************************************************/ -void i810InitTriFuncs( GLcontext *ctx ) +void i810InitTriFuncs( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); static int firsttime = 1; diff --git a/src/mesa/drivers/dri/i810/i810tris.h b/src/mesa/drivers/dri/i810/i810tris.h index ab026be0a5..07a0ebf69f 100644 --- a/src/mesa/drivers/dri/i810/i810tris.h +++ b/src/mesa/drivers/dri/i810/i810tris.h @@ -29,7 +29,7 @@ #include "main/mtypes.h" extern void i810PrintRenderState( const char *msg, GLuint state ); -extern void i810InitTriFuncs( GLcontext *ctx ); -extern void i810RasterPrimitive( GLcontext *ctx, GLenum rprim, GLuint hwprim ); +extern void i810InitTriFuncs( struct gl_context *ctx ); +extern void i810RasterPrimitive( struct gl_context *ctx, GLenum rprim, GLuint hwprim ); #endif diff --git a/src/mesa/drivers/dri/i810/i810vb.c b/src/mesa/drivers/dri/i810/i810vb.c index 70301a2d2e..333e07c0ea 100644 --- a/src/mesa/drivers/dri/i810/i810vb.c +++ b/src/mesa/drivers/dri/i810/i810vb.c @@ -51,10 +51,10 @@ #define I810_MAX_SETUP 0x80 static struct { - void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint ); + void (*emit)( struct gl_context *, GLuint, GLuint, void *, GLuint ); tnl_interp_func interp; tnl_copy_pv_func copy_pv; - GLboolean (*check_tex_sizes)( GLcontext *ctx ); + GLboolean (*check_tex_sizes)( struct gl_context *ctx ); GLuint vertex_size; GLuint vertex_format; } setup_tab[I810_MAX_SETUP]; @@ -335,7 +335,7 @@ static void i810PrintSetupFlags(const char *msg, GLuint flags ) -void i810CheckTexSizes( GLcontext *ctx ) +void i810CheckTexSizes( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); i810ContextPtr imesa = I810_CONTEXT( ctx ); @@ -357,7 +357,7 @@ void i810CheckTexSizes( GLcontext *ctx ) } } -void i810BuildVertices( GLcontext *ctx, +void i810BuildVertices( struct gl_context *ctx, GLuint start, GLuint count, GLuint newinputs ) @@ -405,7 +405,7 @@ void i810BuildVertices( GLcontext *ctx, } } -void i810ChooseVertexState( GLcontext *ctx ) +void i810ChooseVertexState( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); i810ContextPtr imesa = I810_CONTEXT( ctx ); @@ -446,7 +446,7 @@ void i810ChooseVertexState( GLcontext *ctx ) -void *i810_emit_contiguous_verts( GLcontext *ctx, +void *i810_emit_contiguous_verts( struct gl_context *ctx, GLuint start, GLuint count, void *dest ) @@ -459,7 +459,7 @@ void *i810_emit_contiguous_verts( GLcontext *ctx, -void i810InitVB( GLcontext *ctx ) +void i810InitVB( struct gl_context *ctx ) { i810ContextPtr imesa = I810_CONTEXT(ctx); GLuint size = TNL_CONTEXT(ctx)->vb.Size; @@ -476,7 +476,7 @@ void i810InitVB( GLcontext *ctx ) } -void i810FreeVB( GLcontext *ctx ) +void i810FreeVB( struct gl_context *ctx ) { i810ContextPtr imesa = I810_CONTEXT(ctx); if (imesa->verts) { diff --git a/src/mesa/drivers/dri/i810/i810vb.h b/src/mesa/drivers/dri/i810/i810vb.h index 1f704e4569..e321518507 100644 --- a/src/mesa/drivers/dri/i810/i810vb.h +++ b/src/mesa/drivers/dri/i810/i810vb.h @@ -36,24 +36,24 @@ _NEW_FOG) -extern void i810ChooseVertexState( GLcontext *ctx ); -extern void i810CheckTexSizes( GLcontext *ctx ); -extern void i810BuildVertices( GLcontext *ctx, +extern void i810ChooseVertexState( struct gl_context *ctx ); +extern void i810CheckTexSizes( struct gl_context *ctx ); +extern void i810BuildVertices( struct gl_context *ctx, GLuint start, GLuint count, GLuint newinputs ); -extern void *i810_emit_contiguous_verts( GLcontext *ctx, +extern void *i810_emit_contiguous_verts( struct gl_context *ctx, GLuint start, GLuint count, void *dest ); -extern void i810_translate_vertex( GLcontext *ctx, +extern void i810_translate_vertex( struct gl_context *ctx, const i810Vertex *src, SWvertex *dst ); -extern void i810InitVB( GLcontext *ctx ); -extern void i810FreeVB( GLcontext *ctx ); +extern void i810InitVB( struct gl_context *ctx ); +extern void i810FreeVB( struct gl_context *ctx ); #endif diff --git a/src/mesa/drivers/dri/i915/i830_context.c b/src/mesa/drivers/dri/i915/i830_context.c index 8ddce6d82a..abfb32be3a 100644 --- a/src/mesa/drivers/dri/i915/i830_context.c +++ b/src/mesa/drivers/dri/i915/i830_context.c @@ -48,14 +48,14 @@ i830InitDriverFunctions(struct dd_function_table *functions) extern const struct tnl_pipeline_stage *intel_pipeline[]; GLboolean -i830CreateContext(const __GLcontextModes * mesaVis, +i830CreateContext(const struct gl_config * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate) { struct dd_function_table functions; struct i830_context *i830 = CALLOC_STRUCT(i830_context); struct intel_context *intel = &i830->intel; - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; if (!i830) return GL_FALSE; diff --git a/src/mesa/drivers/dri/i915/i830_context.h b/src/mesa/drivers/dri/i915/i830_context.h index 2100ffe6d9..4d568fc0f1 100644 --- a/src/mesa/drivers/dri/i915/i830_context.h +++ b/src/mesa/drivers/dri/i915/i830_context.h @@ -178,7 +178,7 @@ i830_state_draw_region(struct intel_context *intel, /* i830_context.c */ extern GLboolean -i830CreateContext(const __GLcontextModes * mesaVis, +i830CreateContext(const struct gl_config * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate); @@ -205,14 +205,14 @@ extern void i830InitStateFuncs(struct dd_function_table *functions); extern void i830EmitState(struct i830_context *i830); extern void i830InitState(struct i830_context *i830); -extern void i830_update_provoking_vertex(GLcontext *ctx); +extern void i830_update_provoking_vertex(struct gl_context *ctx); /*====================================================================== * Inline conversion functions. These are better-typed than the * macros used previously: */ static INLINE struct i830_context * -i830_context(GLcontext * ctx) +i830_context(struct gl_context * ctx) { return (struct i830_context *) ctx; } diff --git a/src/mesa/drivers/dri/i915/i830_state.c b/src/mesa/drivers/dri/i915/i830_state.c index 38e524e183..147192adc7 100644 --- a/src/mesa/drivers/dri/i915/i830_state.c +++ b/src/mesa/drivers/dri/i915/i830_state.c @@ -47,7 +47,7 @@ #define FILE_DEBUG_FLAG DEBUG_STATE static void -i830StencilFuncSeparate(GLcontext * ctx, GLenum face, GLenum func, GLint ref, +i830StencilFuncSeparate(struct gl_context * ctx, GLenum face, GLenum func, GLint ref, GLuint mask) { struct i830_context *i830 = i830_context(ctx); @@ -72,7 +72,7 @@ i830StencilFuncSeparate(GLcontext * ctx, GLenum face, GLenum func, GLint ref, } static void -i830StencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask) +i830StencilMaskSeparate(struct gl_context * ctx, GLenum face, GLuint mask) { struct i830_context *i830 = i830_context(ctx); @@ -87,7 +87,7 @@ i830StencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask) } static void -i830StencilOpSeparate(GLcontext * ctx, GLenum face, GLenum fail, GLenum zfail, +i830StencilOpSeparate(struct gl_context * ctx, GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { struct i830_context *i830 = i830_context(ctx); @@ -199,7 +199,7 @@ i830StencilOpSeparate(GLcontext * ctx, GLenum face, GLenum fail, GLenum zfail, } static void -i830AlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref) +i830AlphaFunc(struct gl_context * ctx, GLenum func, GLfloat ref) { struct i830_context *i830 = i830_context(ctx); int test = intel_translate_compare_func(func); @@ -228,7 +228,7 @@ i830AlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref) * I'm not sure which is correct. */ static void -i830EvalLogicOpBlendState(GLcontext * ctx) +i830EvalLogicOpBlendState(struct gl_context * ctx) { struct i830_context *i830 = i830_context(ctx); @@ -255,7 +255,7 @@ i830EvalLogicOpBlendState(GLcontext * ctx) } static void -i830BlendColor(GLcontext * ctx, const GLfloat color[4]) +i830BlendColor(struct gl_context * ctx, const GLfloat color[4]) { struct i830_context *i830 = i830_context(ctx); GLubyte r, g, b, a; @@ -279,7 +279,7 @@ i830BlendColor(GLcontext * ctx, const GLfloat color[4]) * change the interpretation of the blend function. */ static void -i830_set_blend_state(GLcontext * ctx) +i830_set_blend_state(struct gl_context * ctx) { struct i830_context *i830 = i830_context(ctx); int funcA; @@ -385,7 +385,7 @@ i830_set_blend_state(GLcontext * ctx) static void -i830BlendEquationSeparate(GLcontext * ctx, GLenum modeRGB, GLenum modeA) +i830BlendEquationSeparate(struct gl_context * ctx, GLenum modeRGB, GLenum modeA) { DBG("%s -> %s, %s\n", __FUNCTION__, _mesa_lookup_enum_by_nr(modeRGB), @@ -398,7 +398,7 @@ i830BlendEquationSeparate(GLcontext * ctx, GLenum modeRGB, GLenum modeA) static void -i830BlendFuncSeparate(GLcontext * ctx, GLenum sfactorRGB, +i830BlendFuncSeparate(struct gl_context * ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA) { DBG("%s -> RGB(%s, %s) A(%s, %s)\n", __FUNCTION__, @@ -417,7 +417,7 @@ i830BlendFuncSeparate(GLcontext * ctx, GLenum sfactorRGB, static void -i830DepthFunc(GLcontext * ctx, GLenum func) +i830DepthFunc(struct gl_context * ctx, GLenum func) { struct i830_context *i830 = i830_context(ctx); int test = intel_translate_compare_func(func); @@ -431,7 +431,7 @@ i830DepthFunc(GLcontext * ctx, GLenum func) } static void -i830DepthMask(GLcontext * ctx, GLboolean flag) +i830DepthMask(struct gl_context * ctx, GLboolean flag) { struct i830_context *i830 = i830_context(ctx); @@ -449,7 +449,7 @@ i830DepthMask(GLcontext * ctx, GLboolean flag) /** Called from ctx->Driver.Viewport() */ static void -i830Viewport(GLcontext * ctx, +i830Viewport(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height) { intelCalcViewport(ctx); @@ -458,7 +458,7 @@ i830Viewport(GLcontext * ctx, /** Called from ctx->Driver.DepthRange() */ static void -i830DepthRange(GLcontext * ctx, GLclampd nearval, GLclampd farval) +i830DepthRange(struct gl_context * ctx, GLclampd nearval, GLclampd farval) { intelCalcViewport(ctx); } @@ -470,7 +470,7 @@ i830DepthRange(GLcontext * ctx, GLclampd nearval, GLclampd farval) * Fortunately stipple is usually a repeating pattern. */ static void -i830PolygonStipple(GLcontext * ctx, const GLubyte * mask) +i830PolygonStipple(struct gl_context * ctx, const GLubyte * mask) { struct i830_context *i830 = i830_context(ctx); const GLubyte *m = mask; @@ -526,7 +526,7 @@ i830PolygonStipple(GLcontext * ctx, const GLubyte * mask) * Hardware clipping */ static void -i830Scissor(GLcontext * ctx, GLint x, GLint y, GLsizei w, GLsizei h) +i830Scissor(struct gl_context * ctx, GLint x, GLint y, GLsizei w, GLsizei h) { struct i830_context *i830 = i830_context(ctx); int x1, y1, x2, y2; @@ -566,7 +566,7 @@ i830Scissor(GLcontext * ctx, GLint x, GLint y, GLsizei w, GLsizei h) } static void -i830LogicOp(GLcontext * ctx, GLenum opcode) +i830LogicOp(struct gl_context * ctx, GLenum opcode) { struct i830_context *i830 = i830_context(ctx); int tmp = intel_translate_logic_op(opcode); @@ -581,7 +581,7 @@ i830LogicOp(GLcontext * ctx, GLenum opcode) static void -i830CullFaceFrontFace(GLcontext * ctx, GLenum unused) +i830CullFaceFrontFace(struct gl_context * ctx, GLenum unused) { struct i830_context *i830 = i830_context(ctx); GLuint mode; @@ -609,7 +609,7 @@ i830CullFaceFrontFace(GLcontext * ctx, GLenum unused) } static void -i830LineWidth(GLcontext * ctx, GLfloat widthf) +i830LineWidth(struct gl_context * ctx, GLfloat widthf) { struct i830_context *i830 = i830_context(ctx); int width; @@ -630,7 +630,7 @@ i830LineWidth(GLcontext * ctx, GLfloat widthf) } static void -i830PointSize(GLcontext * ctx, GLfloat size) +i830PointSize(struct gl_context * ctx, GLfloat size) { struct i830_context *i830 = i830_context(ctx); GLint point_size = (int) size; @@ -650,7 +650,7 @@ i830PointSize(GLcontext * ctx, GLfloat size) */ static void -i830ColorMask(GLcontext * ctx, +i830ColorMask(struct gl_context * ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a) { struct i830_context *i830 = i830_context(ctx); @@ -672,7 +672,7 @@ i830ColorMask(GLcontext * ctx, } static void -update_specular(GLcontext * ctx) +update_specular(struct gl_context * ctx) { struct i830_context *i830 = i830_context(ctx); @@ -686,7 +686,7 @@ update_specular(GLcontext * ctx) } static void -i830LightModelfv(GLcontext * ctx, GLenum pname, const GLfloat * param) +i830LightModelfv(struct gl_context * ctx, GLenum pname, const GLfloat * param) { DBG("%s\n", __FUNCTION__); @@ -698,7 +698,7 @@ i830LightModelfv(GLcontext * ctx, GLenum pname, const GLfloat * param) /* In Mesa 3.5 we can reliably do native flatshading. */ static void -i830ShadeModel(GLcontext * ctx, GLenum mode) +i830ShadeModel(struct gl_context * ctx, GLenum mode) { struct i830_context *i830 = i830_context(ctx); I830_STATECHANGE(i830, I830_UPLOAD_CTX); @@ -727,7 +727,7 @@ i830ShadeModel(GLcontext * ctx, GLenum mode) * Fog */ static void -i830Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param) +i830Fogfv(struct gl_context * ctx, GLenum pname, const GLfloat * param) { struct i830_context *i830 = i830_context(ctx); @@ -748,7 +748,7 @@ i830Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param) */ static void -i830Enable(GLcontext * ctx, GLenum cap, GLboolean state) +i830Enable(struct gl_context * ctx, GLenum cap, GLboolean state) { struct i830_context *i830 = i830_context(ctx); @@ -1067,7 +1067,7 @@ i830_init_packets(struct i830_context *i830) } void -i830_update_provoking_vertex(GLcontext * ctx) +i830_update_provoking_vertex(struct gl_context * ctx) { struct i830_context *i830 = i830_context(ctx); @@ -1119,7 +1119,7 @@ i830InitStateFuncs(struct dd_function_table *functions) void i830InitState(struct i830_context *i830) { - GLcontext *ctx = &i830->intel.ctx; + struct gl_context *ctx = &i830->intel.ctx; i830_init_packets(i830); diff --git a/src/mesa/drivers/dri/i915/i830_texblend.c b/src/mesa/drivers/dri/i915/i830_texblend.c index 3f64be8c96..fec86c56fd 100644 --- a/src/mesa/drivers/dri/i915/i830_texblend.c +++ b/src/mesa/drivers/dri/i915/i830_texblend.c @@ -440,7 +440,7 @@ emit_passthrough(struct i830_context *i830) void i830EmitTextureBlend(struct i830_context *i830) { - GLcontext *ctx = &i830->intel.ctx; + struct gl_context *ctx = &i830->intel.ctx; GLuint unit, last_stage = 0, blendunit = 0; I830_ACTIVESTATE(i830, I830_UPLOAD_TEXBLEND_ALL, GL_FALSE); diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c index ace44430d9..b3bb8837cc 100644 --- a/src/mesa/drivers/dri/i915/i830_texstate.c +++ b/src/mesa/drivers/dri/i915/i830_texstate.c @@ -113,7 +113,7 @@ translate_wrap_mode(GLenum wrap) static GLboolean i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) { - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; struct i830_context *i830 = i830_context(ctx); struct gl_texture_unit *tUnit = &ctx->Texture.Unit[unit]; struct gl_texture_object *tObj = tUnit->_Current; diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c index 0775d7fe94..f7fdb78d05 100644 --- a/src/mesa/drivers/dri/i915/i830_vtbl.c +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c @@ -69,7 +69,7 @@ i830_render_prevalidate(struct intel_context *intel) static void i830_render_start(struct intel_context *intel) { - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; struct i830_context *i830 = i830_context(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; @@ -591,7 +591,7 @@ i830_set_draw_region(struct intel_context *intel, GLuint num_regions) { struct i830_context *i830 = i830_context(&intel->ctx); - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; struct intel_renderbuffer *irb = intel_renderbuffer(rb); GLuint value; @@ -703,6 +703,7 @@ i830_assert_not_dirty( struct intel_context *intel ) { struct i830_context *i830 = i830_context(&intel->ctx); assert(!get_dirty(&i830->state)); + (void) i830; } static void diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index 450e66e0d3..f943f81dd0 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -40,7 +40,6 @@ #include "i915_reg.h" #include "i915_program.h" -#include "intel_tris.h" #include "intel_span.h" /*************************************** @@ -50,7 +49,7 @@ /* Override intel default. */ static void -i915InvalidateState(GLcontext * ctx, GLuint new_state) +i915InvalidateState(struct gl_context * ctx, GLuint new_state) { _swrast_InvalidateState(ctx, new_state); _swsetup_InvalidateState(ctx, new_state); @@ -95,7 +94,7 @@ extern const struct tnl_pipeline_stage *intel_pipeline[]; GLboolean i915CreateContext(int api, - const __GLcontextModes * mesaVis, + const struct gl_config * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate) { @@ -103,14 +102,11 @@ i915CreateContext(int api, struct i915_context *i915 = (struct i915_context *) CALLOC_STRUCT(i915_context); struct intel_context *intel = &i915->intel; - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; if (!i915) return GL_FALSE; - if (0) - printf("\ntexmem-0-3 branch\n\n"); - i915InitVtbl(i915); i915InitDriverFunctions(&functions); diff --git a/src/mesa/drivers/dri/i915/i915_context.h b/src/mesa/drivers/dri/i915/i915_context.h index 33dad9a195..2c80ded075 100644 --- a/src/mesa/drivers/dri/i915/i915_context.h +++ b/src/mesa/drivers/dri/i915/i915_context.h @@ -158,7 +158,7 @@ struct i915_fragment_program /* TODO: split between the stored representation of a program and * the state used to build that representation. */ - GLcontext *ctx; + struct gl_context *ctx; /* declarations contains the packet header. */ GLuint declarations[I915_MAX_DECL_INSN * 3 + 1]; @@ -320,7 +320,7 @@ do { \ * i915_context.c */ extern GLboolean i915CreateContext(int api, - const __GLcontextModes * mesaVis, + const struct gl_config * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate); @@ -337,9 +337,9 @@ extern void i915_print_ureg(const char *msg, GLuint ureg); */ extern void i915InitStateFunctions(struct dd_function_table *functions); extern void i915InitState(struct i915_context *i915); -extern void i915_update_fog(GLcontext * ctx); -extern void i915_update_stencil(GLcontext * ctx); -extern void i915_update_provoking_vertex(GLcontext *ctx); +extern void i915_update_fog(struct gl_context * ctx); +extern void i915_update_stencil(struct gl_context * ctx); +extern void i915_update_provoking_vertex(struct gl_context *ctx); /*====================================================================== @@ -359,7 +359,7 @@ extern void i915InitFragProgFuncs(struct dd_function_table *functions); * macros used previously: */ static INLINE struct i915_context * -i915_context(GLcontext * ctx) +i915_context(struct gl_context * ctx) { return (struct i915_context *) ctx; } diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c index 31988f3d81..c00ee415b6 100644 --- a/src/mesa/drivers/dri/i915/i915_fragprog.c +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c @@ -1186,7 +1186,7 @@ track_params(struct i915_fragment_program *p) static void -i915BindProgram(GLcontext * ctx, GLenum target, struct gl_program *prog) +i915BindProgram(struct gl_context * ctx, GLenum target, struct gl_program *prog) { if (target == GL_FRAGMENT_PROGRAM_ARB) { struct i915_context *i915 = I915_CONTEXT(ctx); @@ -1209,7 +1209,7 @@ i915BindProgram(GLcontext * ctx, GLenum target, struct gl_program *prog) } static struct gl_program * -i915NewProgram(GLcontext * ctx, GLenum target, GLuint id) +i915NewProgram(struct gl_context * ctx, GLenum target, GLuint id) { switch (target) { case GL_VERTEX_PROGRAM_ARB: @@ -1237,7 +1237,7 @@ i915NewProgram(GLcontext * ctx, GLenum target, GLuint id) } static void -i915DeleteProgram(GLcontext * ctx, struct gl_program *prog) +i915DeleteProgram(struct gl_context * ctx, struct gl_program *prog) { if (prog->Target == GL_FRAGMENT_PROGRAM_ARB) { struct i915_context *i915 = I915_CONTEXT(ctx); @@ -1252,7 +1252,7 @@ i915DeleteProgram(GLcontext * ctx, struct gl_program *prog) static GLboolean -i915IsProgramNative(GLcontext * ctx, GLenum target, struct gl_program *prog) +i915IsProgramNative(struct gl_context * ctx, GLenum target, struct gl_program *prog) { if (target == GL_FRAGMENT_PROGRAM_ARB) { struct i915_fragment_program *p = (struct i915_fragment_program *) prog; @@ -1267,7 +1267,7 @@ i915IsProgramNative(GLcontext * ctx, GLenum target, struct gl_program *prog) } static GLboolean -i915ProgramStringNotify(GLcontext * ctx, +i915ProgramStringNotify(struct gl_context * ctx, GLenum target, struct gl_program *prog) { if (target == GL_FRAGMENT_PROGRAM_ARB) { @@ -1291,7 +1291,7 @@ i915ProgramStringNotify(GLcontext * ctx, } void -i915_update_program(GLcontext *ctx) +i915_update_program(struct gl_context *ctx) { struct intel_context *intel = intel_context(ctx); struct i915_context *i915 = i915_context(&intel->ctx); @@ -1316,7 +1316,7 @@ i915_update_program(GLcontext *ctx) void i915ValidateFragmentProgram(struct i915_context *i915) { - GLcontext *ctx = &i915->intel.ctx; + struct gl_context *ctx = &i915->intel.ctx; struct intel_context *intel = intel_context(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; diff --git a/src/mesa/drivers/dri/i915/i915_program.c b/src/mesa/drivers/dri/i915/i915_program.c index 670c713785..ca1949b223 100644 --- a/src/mesa/drivers/dri/i915/i915_program.c +++ b/src/mesa/drivers/dri/i915/i915_program.c @@ -457,7 +457,7 @@ i915_program_error(struct i915_fragment_program *p, const char *fmt, ...) void i915_init_program(struct i915_context *i915, struct i915_fragment_program *p) { - GLcontext *ctx = &i915->intel.ctx; + struct gl_context *ctx = &i915->intel.ctx; p->translated = 0; p->params_uptodate = 0; diff --git a/src/mesa/drivers/dri/i915/i915_program.h b/src/mesa/drivers/dri/i915/i915_program.h index 0d17d04865..20a1354a41 100644 --- a/src/mesa/drivers/dri/i915/i915_program.h +++ b/src/mesa/drivers/dri/i915/i915_program.h @@ -155,6 +155,6 @@ extern void i915_upload_program(struct i915_context *i915, extern void i915_fini_program(struct i915_fragment_program *p); -extern void i915_update_program(GLcontext *ctx); +extern void i915_update_program(struct gl_context *ctx); #endif diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c index 26d387f383..9508fbaf94 100644 --- a/src/mesa/drivers/dri/i915/i915_state.c +++ b/src/mesa/drivers/dri/i915/i915_state.c @@ -49,7 +49,7 @@ #define FILE_DEBUG_FLAG DEBUG_STATE void -i915_update_stencil(GLcontext * ctx) +i915_update_stencil(struct gl_context * ctx) { struct i915_context *i915 = I915_CONTEXT(ctx); GLuint front_ref, front_writemask, front_mask; @@ -147,24 +147,24 @@ i915_update_stencil(GLcontext * ctx) } static void -i915StencilFuncSeparate(GLcontext * ctx, GLenum face, GLenum func, GLint ref, +i915StencilFuncSeparate(struct gl_context * ctx, GLenum face, GLenum func, GLint ref, GLuint mask) { } static void -i915StencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask) +i915StencilMaskSeparate(struct gl_context * ctx, GLenum face, GLuint mask) { } static void -i915StencilOpSeparate(GLcontext * ctx, GLenum face, GLenum fail, GLenum zfail, +i915StencilOpSeparate(struct gl_context * ctx, GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { } static void -i915AlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref) +i915AlphaFunc(struct gl_context * ctx, GLenum func, GLfloat ref) { struct i915_context *i915 = I915_CONTEXT(ctx); int test = intel_translate_compare_func(func); @@ -187,7 +187,7 @@ i915AlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref) * calls to glEnable. */ static void -i915EvalLogicOpBlendState(GLcontext * ctx) +i915EvalLogicOpBlendState(struct gl_context * ctx) { struct i915_context *i915 = I915_CONTEXT(ctx); @@ -210,7 +210,7 @@ i915EvalLogicOpBlendState(GLcontext * ctx) } static void -i915BlendColor(GLcontext * ctx, const GLfloat color[4]) +i915BlendColor(struct gl_context * ctx, const GLfloat color[4]) { struct i915_context *i915 = I915_CONTEXT(ctx); GLubyte r, g, b, a; @@ -255,7 +255,7 @@ translate_blend_equation(GLenum mode) } static void -i915UpdateBlendState(GLcontext * ctx) +i915UpdateBlendState(struct gl_context * ctx) { struct i915_context *i915 = I915_CONTEXT(ctx); GLuint iab = (i915->state.Ctx[I915_CTXREG_IAB] & @@ -306,7 +306,7 @@ i915UpdateBlendState(GLcontext * ctx) static void -i915BlendFuncSeparate(GLcontext * ctx, GLenum srcRGB, +i915BlendFuncSeparate(struct gl_context * ctx, GLenum srcRGB, GLenum dstRGB, GLenum srcA, GLenum dstA) { i915UpdateBlendState(ctx); @@ -314,14 +314,14 @@ i915BlendFuncSeparate(GLcontext * ctx, GLenum srcRGB, static void -i915BlendEquationSeparate(GLcontext * ctx, GLenum eqRGB, GLenum eqA) +i915BlendEquationSeparate(struct gl_context * ctx, GLenum eqRGB, GLenum eqA) { i915UpdateBlendState(ctx); } static void -i915DepthFunc(GLcontext * ctx, GLenum func) +i915DepthFunc(struct gl_context * ctx, GLenum func) { struct i915_context *i915 = I915_CONTEXT(ctx); int test = intel_translate_compare_func(func); @@ -334,7 +334,7 @@ i915DepthFunc(GLcontext * ctx, GLenum func) } static void -i915DepthMask(GLcontext * ctx, GLboolean flag) +i915DepthMask(struct gl_context * ctx, GLboolean flag) { struct i915_context *i915 = I915_CONTEXT(ctx); @@ -357,7 +357,7 @@ i915DepthMask(GLcontext * ctx, GLboolean flag) * - window pos/size or FBO size */ void -intelCalcViewport(GLcontext * ctx) +intelCalcViewport(struct gl_context * ctx) { struct intel_context *intel = intel_context(ctx); const GLfloat *v = ctx->Viewport._WindowMap.m; @@ -390,7 +390,7 @@ intelCalcViewport(GLcontext * ctx) /** Called from ctx->Driver.Viewport() */ static void -i915Viewport(GLcontext * ctx, +i915Viewport(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height) { intelCalcViewport(ctx); @@ -399,7 +399,7 @@ i915Viewport(GLcontext * ctx, /** Called from ctx->Driver.DepthRange() */ static void -i915DepthRange(GLcontext * ctx, GLclampd nearval, GLclampd farval) +i915DepthRange(struct gl_context * ctx, GLclampd nearval, GLclampd farval) { intelCalcViewport(ctx); } @@ -412,7 +412,7 @@ i915DepthRange(GLcontext * ctx, GLclampd nearval, GLclampd farval) * Fortunately stipple is usually a repeating pattern. */ static void -i915PolygonStipple(GLcontext * ctx, const GLubyte * mask) +i915PolygonStipple(struct gl_context * ctx, const GLubyte * mask) { struct i915_context *i915 = I915_CONTEXT(ctx); const GLubyte *m; @@ -474,7 +474,7 @@ i915PolygonStipple(GLcontext * ctx, const GLubyte * mask) * Hardware clipping */ static void -i915Scissor(GLcontext * ctx, GLint x, GLint y, GLsizei w, GLsizei h) +i915Scissor(struct gl_context * ctx, GLint x, GLint y, GLsizei w, GLsizei h) { struct i915_context *i915 = I915_CONTEXT(ctx); int x1, y1, x2, y2; @@ -514,7 +514,7 @@ i915Scissor(GLcontext * ctx, GLint x, GLint y, GLsizei w, GLsizei h) } static void -i915LogicOp(GLcontext * ctx, GLenum opcode) +i915LogicOp(struct gl_context * ctx, GLenum opcode) { struct i915_context *i915 = I915_CONTEXT(ctx); int tmp = intel_translate_logic_op(opcode); @@ -529,7 +529,7 @@ i915LogicOp(GLcontext * ctx, GLenum opcode) static void -i915CullFaceFrontFace(GLcontext * ctx, GLenum unused) +i915CullFaceFrontFace(struct gl_context * ctx, GLenum unused) { struct i915_context *i915 = I915_CONTEXT(ctx); GLuint mode; @@ -560,7 +560,7 @@ i915CullFaceFrontFace(GLcontext * ctx, GLenum unused) } static void -i915LineWidth(GLcontext * ctx, GLfloat widthf) +i915LineWidth(struct gl_context * ctx, GLfloat widthf) { struct i915_context *i915 = I915_CONTEXT(ctx); int lis4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_LINE_WIDTH_MASK; @@ -579,7 +579,7 @@ i915LineWidth(GLcontext * ctx, GLfloat widthf) } static void -i915PointSize(GLcontext * ctx, GLfloat size) +i915PointSize(struct gl_context * ctx, GLfloat size) { struct i915_context *i915 = I915_CONTEXT(ctx); int lis4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_POINT_WIDTH_MASK; @@ -598,7 +598,7 @@ i915PointSize(GLcontext * ctx, GLfloat size) static void -i915PointParameterfv(GLcontext * ctx, GLenum pname, const GLfloat *params) +i915PointParameterfv(struct gl_context * ctx, GLenum pname, const GLfloat *params) { struct i915_context *i915 = I915_CONTEXT(ctx); @@ -620,7 +620,7 @@ i915PointParameterfv(GLcontext * ctx, GLenum pname, const GLfloat *params) */ static void -i915ColorMask(GLcontext * ctx, +i915ColorMask(struct gl_context * ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a) { struct i915_context *i915 = I915_CONTEXT(ctx); @@ -645,7 +645,7 @@ i915ColorMask(GLcontext * ctx, } static void -update_specular(GLcontext * ctx) +update_specular(struct gl_context * ctx) { /* A hack to trigger the rebuild of the fragment program. */ @@ -653,7 +653,7 @@ update_specular(GLcontext * ctx) } static void -i915LightModelfv(GLcontext * ctx, GLenum pname, const GLfloat * param) +i915LightModelfv(struct gl_context * ctx, GLenum pname, const GLfloat * param) { DBG("%s\n", __FUNCTION__); @@ -663,7 +663,7 @@ i915LightModelfv(GLcontext * ctx, GLenum pname, const GLfloat * param) } static void -i915ShadeModel(GLcontext * ctx, GLenum mode) +i915ShadeModel(struct gl_context * ctx, GLenum mode) { struct i915_context *i915 = I915_CONTEXT(ctx); I915_STATECHANGE(i915, I915_UPLOAD_CTX); @@ -684,7 +684,7 @@ i915ShadeModel(GLcontext * ctx, GLenum mode) * Fog */ void -i915_update_fog(GLcontext * ctx) +i915_update_fog(struct gl_context * ctx) { struct i915_context *i915 = I915_CONTEXT(ctx); GLenum mode; @@ -780,7 +780,7 @@ i915_update_fog(GLcontext * ctx) } static void -i915Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param) +i915Fogfv(struct gl_context * ctx, GLenum pname, const GLfloat * param) { struct i915_context *i915 = I915_CONTEXT(ctx); @@ -820,7 +820,7 @@ i915Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param) } static void -i915Hint(GLcontext * ctx, GLenum target, GLenum state) +i915Hint(struct gl_context * ctx, GLenum target, GLenum state) { switch (target) { case GL_FOG_HINT: @@ -834,7 +834,7 @@ i915Hint(GLcontext * ctx, GLenum target, GLenum state) */ static void -i915Enable(GLcontext * ctx, GLenum cap, GLboolean state) +i915Enable(struct gl_context * ctx, GLenum cap, GLboolean state) { struct i915_context *i915 = I915_CONTEXT(ctx); @@ -1093,7 +1093,7 @@ i915_init_packets(struct i915_context *i915) } void -i915_update_provoking_vertex(GLcontext * ctx) +i915_update_provoking_vertex(struct gl_context * ctx) { struct i915_context *i915 = I915_CONTEXT(ctx); @@ -1150,7 +1150,7 @@ i915InitStateFunctions(struct dd_function_table *functions) void i915InitState(struct i915_context *i915) { - GLcontext *ctx = &i915->intel.ctx; + struct gl_context *ctx = &i915->intel.ctx; i915_init_packets(i915); diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index e0e7f3bc3d..c724a21496 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -130,7 +130,7 @@ translate_wrap_mode(GLenum wrap) static GLboolean i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) { - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; struct i915_context *i915 = i915_context(ctx); struct gl_texture_unit *tUnit = &ctx->Texture.Unit[unit]; struct gl_texture_object *tObj = tUnit->_Current; diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c index d7828a296a..59dfe08563 100644 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c @@ -530,7 +530,7 @@ i915_set_draw_region(struct intel_context *intel, GLuint num_regions) { struct i915_context *i915 = i915_context(&intel->ctx); - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; struct intel_renderbuffer *irb = intel_renderbuffer(rb); GLuint value; @@ -669,6 +669,7 @@ i915_assert_not_dirty( struct intel_context *intel ) struct i915_context *i915 = i915_context(&intel->ctx); GLuint dirty = get_dirty(&i915->state); assert(!dirty); + (void) dirty; } void diff --git a/src/mesa/drivers/dri/i915/intel_render.c b/src/mesa/drivers/dri/i915/intel_render.c index add0adacb5..0d8ab4b507 100644 --- a/src/mesa/drivers/dri/i915/intel_render.c +++ b/src/mesa/drivers/dri/i915/intel_render.c @@ -216,7 +216,7 @@ choose_render(struct intel_context *intel, struct vertex_buffer *VB) static GLboolean -intel_run_render(GLcontext * ctx, struct tnl_pipeline_stage *stage) +intel_run_render(struct gl_context * ctx, struct tnl_pipeline_stage *stage) { struct intel_context *intel = intel_context(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -266,7 +266,6 @@ static const struct tnl_pipeline_stage _intel_render_stage = { const struct tnl_pipeline_stage *intel_pipeline[] = { &_tnl_vertex_transform_stage, - &_tnl_vertex_cull_stage, &_tnl_normal_transform_stage, &_tnl_lighting_stage, &_tnl_fog_coordinate_stage, diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c index ede111b87a..b9a8aeb12f 100644 --- a/src/mesa/drivers/dri/i915/intel_tris.c +++ b/src/mesa/drivers/dri/i915/intel_tris.c @@ -55,8 +55,8 @@ #include "i830_context.h" #include "i830_reg.h" -static void intelRenderPrimitive(GLcontext * ctx, GLenum prim); -static void intelRasterPrimitive(GLcontext * ctx, GLenum rprim, +static void intelRenderPrimitive(struct gl_context * ctx, GLenum prim); +static void intelRasterPrimitive(struct gl_context * ctx, GLenum rprim, GLuint hwprim); static void @@ -427,7 +427,7 @@ intel_draw_point(struct intel_context *intel, intelVertexPtr v0) static void intel_atten_point(struct intel_context *intel, intelVertexPtr v0) { - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; GLfloat psz[4], col[4], restore_psz, restore_alpha; _tnl_get_attr(ctx, v0, _TNL_ATTRIB_POINTSIZE, psz); @@ -784,7 +784,7 @@ static void intel_fallback_tri(struct intel_context *intel, intelVertex * v0, intelVertex * v1, intelVertex * v2) { - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; SWvertex v[3]; if (0) @@ -805,7 +805,7 @@ static void intel_fallback_line(struct intel_context *intel, intelVertex * v0, intelVertex * v1) { - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; SWvertex v[2]; if (0) @@ -824,7 +824,7 @@ static void intel_fallback_point(struct intel_context *intel, intelVertex * v0) { - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; SWvertex v[1]; if (0) @@ -877,7 +877,7 @@ intel_fallback_point(struct intel_context *intel, static void -intelRenderClippedPoly(GLcontext * ctx, const GLuint * elts, GLuint n) +intelRenderClippedPoly(struct gl_context * ctx, const GLuint * elts, GLuint n) { struct intel_context *intel = intel_context(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -901,7 +901,7 @@ intelRenderClippedPoly(GLcontext * ctx, const GLuint * elts, GLuint n) } static void -intelRenderClippedLine(GLcontext * ctx, GLuint ii, GLuint jj) +intelRenderClippedLine(struct gl_context * ctx, GLuint ii, GLuint jj) { TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -909,7 +909,7 @@ intelRenderClippedLine(GLcontext * ctx, GLuint ii, GLuint jj) } static void -intelFastRenderClippedPoly(GLcontext * ctx, const GLuint * elts, GLuint n) +intelFastRenderClippedPoly(struct gl_context * ctx, const GLuint * elts, GLuint n) { struct intel_context *intel = intel_context(ctx); const GLuint vertsize = intel->vertex_size; @@ -936,7 +936,7 @@ intelFastRenderClippedPoly(GLcontext * ctx, const GLuint * elts, GLuint n) #define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE | DD_TRI_OFFSET | DD_TRI_UNFILLED) void -intelChooseRenderState(GLcontext * ctx) +intelChooseRenderState(struct gl_context * ctx) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct intel_context *intel = intel_context(ctx); @@ -1049,7 +1049,7 @@ static const GLenum reduced_prim[GL_POLYGON + 1] = { static void -intelRunPipeline(GLcontext * ctx) +intelRunPipeline(struct gl_context * ctx) { struct intel_context *intel = intel_context(ctx); @@ -1079,7 +1079,7 @@ intelRunPipeline(GLcontext * ctx) } static void -intelRenderStart(GLcontext * ctx) +intelRenderStart(struct gl_context * ctx) { struct intel_context *intel = intel_context(ctx); @@ -1089,7 +1089,7 @@ intelRenderStart(GLcontext * ctx) } static void -intelRenderFinish(GLcontext * ctx) +intelRenderFinish(struct gl_context * ctx) { struct intel_context *intel = intel_context(ctx); @@ -1106,7 +1106,7 @@ intelRenderFinish(GLcontext * ctx) * primitive. */ static void -intelRasterPrimitive(GLcontext * ctx, GLenum rprim, GLuint hwprim) +intelRasterPrimitive(struct gl_context * ctx, GLenum rprim, GLuint hwprim) { struct intel_context *intel = intel_context(ctx); @@ -1129,7 +1129,7 @@ intelRasterPrimitive(GLcontext * ctx, GLenum rprim, GLuint hwprim) /* */ static void -intelRenderPrimitive(GLcontext * ctx, GLenum prim) +intelRenderPrimitive(struct gl_context * ctx, GLenum prim) { struct intel_context *intel = intel_context(ctx); @@ -1201,7 +1201,7 @@ getFallbackString(GLuint bit) void intelFallback(struct intel_context *intel, GLbitfield bit, GLboolean mode) { - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; TNLcontext *tnl = TNL_CONTEXT(ctx); const GLbitfield oldfallback = intel->Fallback; @@ -1253,7 +1253,7 @@ union fi void -intelInitTriFuncs(GLcontext * ctx) +intelInitTriFuncs(struct gl_context * ctx) { TNLcontext *tnl = TNL_CONTEXT(ctx); static int firsttime = 1; diff --git a/src/mesa/drivers/dri/i915/intel_tris.h b/src/mesa/drivers/dri/i915/intel_tris.h index 55b60a47f9..ad84de828b 100644 --- a/src/mesa/drivers/dri/i915/intel_tris.h +++ b/src/mesa/drivers/dri/i915/intel_tris.h @@ -42,9 +42,9 @@ _NEW_PROGRAM | \ _NEW_POLYGONSTIPPLE) -extern void intelInitTriFuncs(GLcontext * ctx); +extern void intelInitTriFuncs(struct gl_context * ctx); -extern void intelChooseRenderState(GLcontext * ctx); +extern void intelChooseRenderState(struct gl_context * ctx); void intel_set_prim(struct intel_context *intel, uint32_t prim); GLuint *intel_get_prim_space(struct intel_context *intel, unsigned int count); diff --git a/src/mesa/drivers/dri/i965/Makefile b/src/mesa/drivers/dri/i965/Makefile index bea48e1313..917d39061d 100644 --- a/src/mesa/drivers/dri/i965/Makefile +++ b/src/mesa/drivers/dri/i965/Makefile @@ -105,6 +105,7 @@ C_SOURCES = \ $(DRIVER_SOURCES) CXX_SOURCES = \ + brw_cubemap_normalize.cpp \ brw_fs.cpp \ brw_fs_channel_expressions.cpp \ brw_fs_vector_splitting.cpp diff --git a/src/mesa/drivers/dri/i965/brw_cc.c b/src/mesa/drivers/dri/i965/brw_cc.c index cfce5d3140..00418760da 100644 --- a/src/mesa/drivers/dri/i965/brw_cc.c +++ b/src/mesa/drivers/dri/i965/brw_cc.c @@ -39,7 +39,7 @@ void brw_update_cc_vp(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct brw_cc_viewport ccv; memset(&ccv, 0, sizeof(ccv)); @@ -90,7 +90,8 @@ static void prepare_cc_unit(struct brw_context *brw) */ static void upload_cc_unit(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct intel_context *intel = &brw->intel; + struct gl_context *ctx = &brw->intel.ctx; struct brw_cc_unit_state cc; void *map; @@ -203,12 +204,12 @@ static void upload_cc_unit(struct brw_context *brw) cc.cc2.depth_write_enable = ctx->Depth.Mask; } + if (intel->stats_wm || (INTEL_DEBUG & DEBUG_STATS)) + cc.cc5.statistics_enable = 1; + /* CACHE_NEW_CC_VP */ cc.cc4.cc_viewport_state_offset = brw->cc.vp_bo->offset >> 5; /* reloc */ - if (INTEL_DEBUG & DEBUG_STATS) - cc.cc5.statistics_enable = 1; - map = brw_state_batch(brw, sizeof(cc), 64, &brw->cc.state_bo, &brw->cc.state_offset); memcpy(map, &cc, sizeof(cc)); diff --git a/src/mesa/drivers/dri/i965/brw_clip.c b/src/mesa/drivers/dri/i965/brw_clip.c index a1e9dae915..15e60bf3ce 100644 --- a/src/mesa/drivers/dri/i965/brw_clip.c +++ b/src/mesa/drivers/dri/i965/brw_clip.c @@ -159,7 +159,7 @@ static void compile_clip_prog( struct brw_context *brw, static void upload_clip_prog(struct brw_context *brw) { struct intel_context *intel = &brw->intel; - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; struct brw_clip_prog_key key; memset(&key, 0, sizeof(key)); diff --git a/src/mesa/drivers/dri/i965/brw_clip_state.c b/src/mesa/drivers/dri/i965/brw_clip_state.c index 856d8f0c6c..885167da90 100644 --- a/src/mesa/drivers/dri/i965/brw_clip_state.c +++ b/src/mesa/drivers/dri/i965/brw_clip_state.c @@ -49,7 +49,7 @@ struct brw_clip_unit_key { static void clip_unit_populate_key(struct brw_context *brw, struct brw_clip_unit_key *key) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; memset(key, 0, sizeof(*key)); /* CACHE_NEW_CLIP_PROG */ diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index d08538ec20..3c4ae8a7a4 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -41,7 +41,6 @@ #include "intel_span.h" #include "tnl/t_pipeline.h" - /*************************************** * Mesa's Driver Functions ***************************************/ @@ -58,14 +57,14 @@ static void brwInitDriverFunctions( struct dd_function_table *functions ) } GLboolean brwCreateContext( int api, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, __DRIcontext *driContextPriv, void *sharedContextPrivate) { struct dd_function_table functions; struct brw_context *brw = (struct brw_context *) CALLOC_STRUCT(brw_context); struct intel_context *intel = &brw->intel; - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; unsigned i; if (!brw) { @@ -123,6 +122,9 @@ GLboolean brwCreateContext( int api, (i == MESA_SHADER_FRAGMENT); ctx->ShaderCompilerOptions[i].EmitNoIndirectTemp = (i == MESA_SHADER_FRAGMENT); + + if (intel->gen == 6) + ctx->ShaderCompilerOptions[i].EmitNoIfs = GL_TRUE; } ctx->Const.VertexProgram.MaxNativeInstructions = (16 * 1024); diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 703a7de78d..f205c07a72 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -719,7 +719,7 @@ void brwInitVtbl( struct brw_context *brw ); * brw_context.c */ GLboolean brwCreateContext( int api, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, __DRIcontext *driContextPriv, void *sharedContextPrivate); @@ -763,15 +763,15 @@ void brw_upload_cs_urb_state(struct brw_context *brw); int brw_disasm (FILE *file, struct brw_instruction *inst, int gen); /* brw_state.c */ -void brw_enable(GLcontext * ctx, GLenum cap, GLboolean state); -void brw_depth_range(GLcontext *ctx, GLclampd nearval, GLclampd farval); +void brw_enable(struct gl_context * ctx, GLenum cap, GLboolean state); +void brw_depth_range(struct gl_context *ctx, GLclampd nearval, GLclampd farval); /*====================================================================== * Inline conversion functions. These are better-typed than the * macros used previously: */ static INLINE struct brw_context * -brw_context( GLcontext *ctx ) +brw_context( struct gl_context *ctx ) { return (struct brw_context *)ctx; } @@ -800,5 +800,7 @@ brw_fragment_program_const(const struct gl_fragment_program *p) return (const struct brw_fragment_program *) p; } +GLboolean brw_do_cubemap_normalize(struct exec_list *instructions); + #endif diff --git a/src/mesa/drivers/dri/i965/brw_cubemap_normalize.cpp b/src/mesa/drivers/dri/i965/brw_cubemap_normalize.cpp new file mode 100644 index 0000000000..35bea68121 --- /dev/null +++ b/src/mesa/drivers/dri/i965/brw_cubemap_normalize.cpp @@ -0,0 +1,110 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file brw_cubemap_normalize.cpp + * + * IR lower pass to perform the normalization of the cubemap coordinates to + * have the largest magnitude component be -1.0 or 1.0. + * + * \author Eric Anholt <eric@anholt.net> + */ + +#include "../glsl/glsl_types.h" +#include "../glsl/ir.h" + +class brw_cubemap_normalize_visitor : public ir_hierarchical_visitor { +public: + brw_cubemap_normalize_visitor() + { + progress = false; + } + + ir_visitor_status visit_leave(ir_texture *ir); + + bool progress; +}; + +ir_visitor_status +brw_cubemap_normalize_visitor::visit_leave(ir_texture *ir) +{ + if (ir->sampler->type->sampler_dimensionality != GLSL_SAMPLER_DIM_CUBE) + return visit_continue; + + void *mem_ctx = talloc_parent(ir); + + ir_variable *var = new(mem_ctx) ir_variable(ir->coordinate->type, + "coordinate", ir_var_auto); + base_ir->insert_before(var); + ir_dereference *deref = new(mem_ctx) ir_dereference_variable(var); + ir_assignment *assign = new(mem_ctx) ir_assignment(deref, ir->coordinate, + NULL); + base_ir->insert_before(assign); + + deref = new(mem_ctx) ir_dereference_variable(var); + ir_rvalue *swiz0 = new(mem_ctx) ir_swizzle(deref, 0, 0, 0, 0, 1); + deref = new(mem_ctx) ir_dereference_variable(var); + ir_rvalue *swiz1 = new(mem_ctx) ir_swizzle(deref, 1, 0, 0, 0, 1); + deref = new(mem_ctx) ir_dereference_variable(var); + ir_rvalue *swiz2 = new(mem_ctx) ir_swizzle(deref, 2, 0, 0, 0, 1); + + swiz0 = new(mem_ctx) ir_expression(ir_unop_abs, swiz0->type, swiz0, NULL); + swiz1 = new(mem_ctx) ir_expression(ir_unop_abs, swiz1->type, swiz1, NULL); + swiz2 = new(mem_ctx) ir_expression(ir_unop_abs, swiz2->type, swiz2, NULL); + + ir_expression *expr; + expr = new(mem_ctx) ir_expression(ir_binop_max, + glsl_type::float_type, + swiz0, swiz1); + + expr = new(mem_ctx) ir_expression(ir_binop_max, + glsl_type::float_type, + expr, swiz2); + + expr = new(mem_ctx) ir_expression(ir_unop_rcp, + glsl_type::float_type, + expr, NULL); + + deref = new(mem_ctx) ir_dereference_variable(var); + ir->coordinate = new(mem_ctx) ir_expression(ir_binop_mul, + ir->coordinate->type, + deref, + expr); + + progress = true; + return visit_continue; +} + +extern "C" { + +GLboolean +brw_do_cubemap_normalize(exec_list *instructions) +{ + brw_cubemap_normalize_visitor v; + + visit_list_elements(&v, instructions); + + return v.progress; +} + +} diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index 8196d8ca62..9ce0d8decd 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -55,7 +55,7 @@ */ static void calculate_curbe_offsets( struct brw_context *brw ) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; /* CACHE_NEW_WM_PROG */ const GLuint nr_fp_regs = (brw->wm.prog_data->nr_params + 15) / 16; @@ -179,7 +179,7 @@ static GLfloat fixed_plane[6][4] = { */ static void prepare_constant_buffer(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; const struct brw_vertex_program *vp = brw_vertex_program_const(brw->vertex_program); const GLuint sz = brw->curbe.total_size; diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h index 6b8e9e05d0..9633c95ff5 100644 --- a/src/mesa/drivers/dri/i965/brw_defines.h +++ b/src/mesa/drivers/dri/i965/brw_defines.h @@ -501,9 +501,26 @@ #define BRW_MASK_ENABLE 0 #define BRW_MASK_DISABLE 1 -/* Sandybridge is WECtrl (Write enable control) */ +/** @{ + * + * Gen6 has replaced "mask enable/disable" with WECtrl, which is + * effectively the same but much simpler to think about. Now, there + * are two contributors ANDed together to whether channels are + * executed: The predication on the instruction, and the channel write + * enable. + */ +/** + * This is the default value. It means that a channel's write enable is set + * if the per-channel IP is pointing at this instruction. + */ #define BRW_WE_NORMAL 0 -#define BRW_WE_KILL_PRED 1 +/** + * This is used like BRW_MASK_DISABLE, and causes all channels to have + * their write enable set. Note that predication still contributes to + * whether the channel actually gets written. + */ +#define BRW_WE_ALL 1 +/** @} */ #define BRW_OPCODE_MOV 1 #define BRW_OPCODE_SEL 2 @@ -930,6 +947,7 @@ /* DW3 */ # define GEN6_CLIP_MIN_POINT_WIDTH_SHIFT 17 # define GEN6_CLIP_MAX_POINT_WIDTH_SHIFT 6 +# define GEN6_CLIP_FORCE_ZERO_RTAINDEX (1 << 5) #define CMD_3D_SF_STATE 0x7813 /* GEN6+ */ /* DW1 */ diff --git a/src/mesa/drivers/dri/i965/brw_disasm.c b/src/mesa/drivers/dri/i965/brw_disasm.c index f74a236834..12b8f2e467 100644 --- a/src/mesa/drivers/dri/i965/brw_disasm.c +++ b/src/mesa/drivers/dri/i965/brw_disasm.c @@ -164,6 +164,11 @@ char *accwr[2] = { [1] = "AccWrEnable" }; +char *wectrl[2] = { + [0] = "WE_normal", + [1] = "WE_all" +}; + char *exec_size[8] = { [0] = "1", [1] = "2", @@ -651,6 +656,7 @@ static int src_da16 (FILE *file, err |= control (file, "channel select", chan_sel, swz_z, NULL); err |= control (file, "channel select", chan_sel, swz_w, NULL); } + err |= control (file, "src da16 reg type", reg_encoding, _reg_type, NULL); return err; } @@ -804,6 +810,44 @@ static int src1 (FILE *file, struct brw_instruction *inst) } } +int esize[6] = { + [0] = 1, + [1] = 2, + [2] = 4, + [3] = 8, + [4] = 16, + [5] = 32, +}; + +static int qtr_ctrl(FILE *file, struct brw_instruction *inst) +{ + int qtr_ctl = inst->header.compression_control; + int exec_size = esize[inst->header.execution_size]; + + if (exec_size == 8) { + switch (qtr_ctl) { + case 0: + string (file, " 1Q"); + break; + case 1: + string (file, " 2Q"); + break; + case 2: + string (file, " 3Q"); + break; + case 3: + string (file, " 4Q"); + break; + } + } else if (exec_size == 16){ + if (qtr_ctl < 2) + string (file, " 1H"); + else + string (file, " 2H"); + } + return 0; +} + int brw_disasm (FILE *file, struct brw_instruction *inst, int gen) { int err = 0; @@ -842,13 +886,18 @@ int brw_disasm (FILE *file, struct brw_instruction *inst, int gen) string (file, ")"); } - if (inst->header.opcode == BRW_OPCODE_SEND) + if (inst->header.opcode == BRW_OPCODE_SEND && gen < 6) format (file, " %d", inst->header.destreg__conditionalmod); if (opcode[inst->header.opcode].ndst > 0) { pad (file, 16); err |= dest (file, inst); + } else if (gen >= 6 && (inst->header.opcode == BRW_OPCODE_IF || + inst->header.opcode == BRW_OPCODE_ELSE || + inst->header.opcode == BRW_OPCODE_ENDIF)) { + format (file, " %d", inst->bits1.branch_gen6.jump_count); } + if (opcode[inst->header.opcode].nsrc > 0) { pad (file, 32); err |= src0 (file, inst); @@ -998,18 +1047,26 @@ int brw_disasm (FILE *file, struct brw_instruction *inst, int gen) string (file, "{"); space = 1; err |= control(file, "access mode", access_mode, inst->header.access_mode, &space); - err |= control (file, "mask control", mask_ctrl, inst->header.mask_control, &space); + if (gen >= 6) + err |= control (file, "write enable control", wectrl, inst->header.mask_control, &space); + else + err |= control (file, "mask control", mask_ctrl, inst->header.mask_control, &space); err |= control (file, "dependency control", dep_ctrl, inst->header.dependency_control, &space); - if (inst->header.compression_control == BRW_COMPRESSION_COMPRESSED && - opcode[inst->header.opcode].ndst > 0 && - inst->bits1.da1.dest_reg_file == BRW_MESSAGE_REGISTER_FILE && - inst->bits1.da1.dest_reg_nr & (1 << 7)) { - format (file, " compr4"); - } else { - err |= control (file, "compression control", compr_ctrl, - inst->header.compression_control, &space); + if (gen >= 6) + err |= qtr_ctrl (file, inst); + else { + if (inst->header.compression_control == BRW_COMPRESSION_COMPRESSED && + opcode[inst->header.opcode].ndst > 0 && + inst->bits1.da1.dest_reg_file == BRW_MESSAGE_REGISTER_FILE && + inst->bits1.da1.dest_reg_nr & (1 << 7)) { + format (file, " compr4"); + } else { + err |= control (file, "compression control", compr_ctrl, + inst->header.compression_control, &space); + } } + err |= control (file, "thread control", thread_ctrl, inst->header.thread_control, &space); if (gen >= 6) err |= control (file, "acc write control", accwr, inst->header.acc_wr_control, &space); diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index 16331cc3ac..04bc8cb2db 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -80,7 +80,7 @@ static const GLenum reduced_prim[GL_POLYGON+1] = { static GLuint brw_set_prim(struct brw_context *brw, const struct _mesa_prim *prim) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; GLenum mode = prim->mode; if (INTEL_DEBUG & DEBUG_PRIMS) @@ -201,7 +201,7 @@ static GLboolean check_fallbacks( struct brw_context *brw, const struct _mesa_prim *prim, GLuint nr_prims ) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; GLuint i; /* If we don't require strict OpenGL conformance, never @@ -293,7 +293,7 @@ static GLboolean check_fallbacks( struct brw_context *brw, /* May fail if out of video memory for texture or vbo upload, or on * fallback conditions. */ -static GLboolean brw_try_draw_prims( GLcontext *ctx, +static GLboolean brw_try_draw_prims( struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, @@ -416,7 +416,7 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx, return retval; } -void brw_draw_prims( GLcontext *ctx, +void brw_draw_prims( struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, @@ -434,7 +434,7 @@ void brw_draw_prims( GLcontext *ctx, /* Decide if we want to rebase. If so we end up recursing once * only into this function. */ - if (min_index != 0) { + if (min_index != 0 && !vbo_any_varyings_in_vbos(arrays)) { vbo_rebase_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index, @@ -460,7 +460,7 @@ void brw_draw_prims( GLcontext *ctx, void brw_draw_init( struct brw_context *brw ) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct vbo_context *vbo = vbo_context(ctx); /* Register our drawing function: diff --git a/src/mesa/drivers/dri/i965/brw_draw.h b/src/mesa/drivers/dri/i965/brw_draw.h index 2a14db217f..1fe417296f 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.h +++ b/src/mesa/drivers/dri/i965/brw_draw.h @@ -28,13 +28,13 @@ #ifndef BRW_DRAW_H #define BRW_DRAW_H -#include "main/mtypes.h" /* for GLcontext... */ +#include "main/mtypes.h" /* for struct gl_context... */ #include "vbo/vbo.h" struct brw_context; -void brw_draw_prims( GLcontext *ctx, +void brw_draw_prims( struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prims, GLuint nr_prims, @@ -48,7 +48,7 @@ void brw_draw_destroy( struct brw_context *brw ); /* brw_draw_current.c */ -void brw_init_current_values(GLcontext *ctx, +void brw_init_current_values(struct gl_context *ctx, struct gl_client_array *arrays); #endif diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index 249e874ab1..c4654360d4 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -313,7 +313,7 @@ copy_array_to_vbo_array( struct brw_context *brw, static void brw_prepare_vertices(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct intel_context *intel = intel_context(ctx); GLbitfield vs_inputs = brw->vs.prog_data->inputs_read; GLuint i; @@ -383,7 +383,7 @@ static void brw_prepare_vertices(struct brw_context *brw) */ assert(input->offset < input->bo->size); } else { - input->count = input->glarray->StrideB ? max_index + 1 - min_index : 1; + input->count = input->glarray->StrideB ? max_index + 1 : 1; if (input->bo != NULL) { /* Already-uploaded vertex data is present from a previous * prepare_vertices, but we had to re-validate state due to @@ -414,15 +414,6 @@ static void brw_prepare_vertices(struct brw_context *brw) } upload[nr_uploads++] = input; - - /* We rebase drawing to start at element zero only when - * varyings are not in vbos, which means we can end up - * uploading non-varying arrays (stride != 0) when min_index - * is zero. This doesn't matter as the amount to upload is - * the same for these arrays whether the draw call is rebased - * or not - we just have to upload the one element. - */ - assert(min_index == 0 || input->glarray->StrideB == 0); } } @@ -460,7 +451,7 @@ static void brw_prepare_vertices(struct brw_context *brw) static void brw_emit_vertices(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct intel_context *intel = intel_context(ctx); GLuint i; @@ -592,7 +583,7 @@ const struct brw_tracked_state brw_vertices = { static void brw_prepare_indices(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct intel_context *intel = &brw->intel; const struct _mesa_index_buffer *index_buffer = brw->ib.ib; GLuint ib_size; diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h index c63db16460..7cac4a72e4 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.h +++ b/src/mesa/drivers/dri/i965/brw_eu.h @@ -789,6 +789,10 @@ struct brw_instruction *brw_##OP(struct brw_compile *p, \ struct brw_reg src0, \ struct brw_reg src1); +#define ROUND(OP) \ +void brw_##OP(struct brw_compile *p, struct brw_reg dest, struct brw_reg src0); + + ALU1(MOV) ALU2(SEL) ALU1(NOT) @@ -805,7 +809,6 @@ ALU2(ADD) ALU2(MUL) ALU1(FRC) ALU1(RNDD) -ALU1(RNDZ) ALU2(MAC) ALU2(MACH) ALU1(LZD) @@ -816,9 +819,12 @@ ALU2(DP2) ALU2(LINE) ALU2(PLN) +ROUND(RNDZ) +ROUND(RNDE) + #undef ALU1 #undef ALU2 - +#undef ROUND /* Helpers for SEND instruction: @@ -885,6 +891,12 @@ void brw_math( struct brw_compile *p, GLuint data_type, GLuint precision ); +void brw_math2(struct brw_compile *p, + struct brw_reg dest, + GLuint function, + struct brw_reg src0, + struct brw_reg src1); + void brw_dp_READ_16( struct brw_compile *p, struct brw_reg dest, GLuint scratch_offset ); diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index ddd3a94eb0..a1fead0a4f 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -448,6 +448,7 @@ static void brw_set_dp_write_message( struct brw_context *brw, GLuint msg_control, GLuint msg_type, GLuint msg_length, + GLboolean header_present, GLuint pixel_scoreboard_clear, GLuint response_length, GLuint end_of_thread, @@ -462,7 +463,7 @@ static void brw_set_dp_write_message( struct brw_context *brw, insn->bits3.dp_render_cache.pixel_scoreboard_clear = pixel_scoreboard_clear; insn->bits3.dp_render_cache.msg_type = msg_type; insn->bits3.dp_render_cache.send_commit_msg = send_commit_msg; - insn->bits3.dp_render_cache.header_present = 0; /* XXX */ + insn->bits3.dp_render_cache.header_present = header_present; insn->bits3.dp_render_cache.response_length = response_length; insn->bits3.dp_render_cache.msg_length = msg_length; insn->bits3.dp_render_cache.end_of_thread = end_of_thread; @@ -476,7 +477,7 @@ static void brw_set_dp_write_message( struct brw_context *brw, insn->bits3.dp_write_gen5.pixel_scoreboard_clear = pixel_scoreboard_clear; insn->bits3.dp_write_gen5.msg_type = msg_type; insn->bits3.dp_write_gen5.send_commit_msg = send_commit_msg; - insn->bits3.dp_write_gen5.header_present = 1; + insn->bits3.dp_write_gen5.header_present = header_present; insn->bits3.dp_write_gen5.response_length = response_length; insn->bits3.dp_write_gen5.msg_length = msg_length; insn->bits3.dp_write_gen5.end_of_thread = end_of_thread; @@ -548,7 +549,7 @@ static void brw_set_sampler_message(struct brw_context *brw, assert(eot == 0); brw_set_src1(insn, brw_imm_d(0)); - if (intel->gen == 5) { + if (intel->gen >= 5) { insn->bits3.sampler_gen5.binding_table_index = binding_table_index; insn->bits3.sampler_gen5.sampler = sampler; insn->bits3.sampler_gen5.msg_type = msg_type; @@ -557,8 +558,12 @@ static void brw_set_sampler_message(struct brw_context *brw, insn->bits3.sampler_gen5.response_length = response_length; insn->bits3.sampler_gen5.msg_length = msg_length; insn->bits3.sampler_gen5.end_of_thread = eot; - insn->bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_SAMPLER; - insn->bits2.send_gen5.end_of_thread = eot; + if (intel->gen >= 6) + insn->header.destreg__conditionalmod = BRW_MESSAGE_TARGET_SAMPLER; + else { + insn->bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_SAMPLER; + insn->bits2.send_gen5.end_of_thread = eot; + } } else if (intel->is_g4x) { insn->bits3.sampler_g4x.binding_table_index = binding_table_index; insn->bits3.sampler_g4x.sampler = sampler; @@ -649,6 +654,26 @@ struct brw_instruction *brw_##OP(struct brw_compile *p, \ return brw_alu2(p, BRW_OPCODE_##OP, dest, src0, src1); \ } +/* Rounding operations (other than RNDD) require two instructions - the first + * stores a rounded value (possibly the wrong way) in the dest register, but + * also sets a per-channel "increment bit" in the flag register. A predicated + * add of 1.0 fixes dest to contain the desired result. + */ +#define ROUND(OP) \ +void brw_##OP(struct brw_compile *p, \ + struct brw_reg dest, \ + struct brw_reg src) \ +{ \ + struct brw_instruction *rnd, *add; \ + rnd = next_insn(p, BRW_OPCODE_##OP); \ + brw_set_dest(rnd, dest); \ + brw_set_src0(rnd, src); \ + rnd->header.destreg__conditionalmod = 0x7; /* turn on round-increments */ \ + \ + add = brw_ADD(p, dest, dest, brw_imm_f(1.0f)); \ + add->header.predicate_control = BRW_PREDICATE_NORMAL; \ +} + ALU1(MOV) ALU2(SEL) @@ -663,7 +688,6 @@ ALU2(RSL) ALU2(ASR) ALU1(FRC) ALU1(RNDD) -ALU1(RNDZ) ALU2(MAC) ALU2(MACH) ALU1(LZD) @@ -674,6 +698,11 @@ ALU2(DP2) ALU2(LINE) ALU2(PLN) + +ROUND(RNDZ) +ROUND(RNDE) + + struct brw_instruction *brw_ADD(struct brw_compile *p, struct brw_reg dest, struct brw_reg src0, @@ -782,6 +811,7 @@ struct brw_instruction *brw_JMPI(struct brw_compile *p, */ struct brw_instruction *brw_IF(struct brw_compile *p, GLuint execute_size) { + struct intel_context *intel = &p->brw->intel; struct brw_instruction *insn; if (p->single_program_flow) { @@ -795,9 +825,15 @@ struct brw_instruction *brw_IF(struct brw_compile *p, GLuint execute_size) /* Override the defaults for this instruction: */ - brw_set_dest(insn, brw_ip_reg()); - brw_set_src0(insn, brw_ip_reg()); - brw_set_src1(insn, brw_imm_d(0x0)); + if (intel->gen < 6) { + brw_set_dest(insn, brw_ip_reg()); + brw_set_src0(insn, brw_ip_reg()); + brw_set_src1(insn, brw_imm_d(0x0)); + } else { + brw_set_dest(insn, brw_imm_w(0)); + brw_set_src0(insn, brw_null_reg()); + brw_set_src1(insn, brw_null_reg()); + } insn->header.execution_size = execute_size; insn->header.compression_control = BRW_COMPRESSION_NONE; @@ -819,7 +855,9 @@ struct brw_instruction *brw_ELSE(struct brw_compile *p, struct brw_instruction *insn; GLuint br = 1; - if (intel->gen == 5) + /* jump count is for 64bit data chunk each, so one 128bit + instruction requires 2 chunks. */ + if (intel->gen >= 5) br = 2; if (p->single_program_flow) { @@ -828,9 +866,15 @@ struct brw_instruction *brw_ELSE(struct brw_compile *p, insn = next_insn(p, BRW_OPCODE_ELSE); } - brw_set_dest(insn, brw_ip_reg()); - brw_set_src0(insn, brw_ip_reg()); - brw_set_src1(insn, brw_imm_d(0x0)); + if (intel->gen < 6) { + brw_set_dest(insn, brw_ip_reg()); + brw_set_src0(insn, brw_ip_reg()); + brw_set_src1(insn, brw_imm_d(0x0)); + } else { + brw_set_dest(insn, brw_imm_w(0)); + brw_set_src0(insn, brw_null_reg()); + brw_set_src1(insn, brw_null_reg()); + } insn->header.compression_control = BRW_COMPRESSION_NONE; insn->header.execution_size = if_insn->header.execution_size; @@ -847,9 +891,13 @@ struct brw_instruction *brw_ELSE(struct brw_compile *p, } else { assert(if_insn->header.opcode == BRW_OPCODE_IF); - if_insn->bits3.if_else.jump_count = br * (insn - if_insn); - if_insn->bits3.if_else.pop_count = 0; - if_insn->bits3.if_else.pad0 = 0; + if (intel->gen < 6) { + if_insn->bits3.if_else.jump_count = br * (insn - if_insn); + if_insn->bits3.if_else.pop_count = 0; + if_insn->bits3.if_else.pad0 = 0; + } else { + if_insn->bits1.branch_gen6.jump_count = br * (insn - if_insn + 1); + } } return insn; @@ -861,7 +909,7 @@ void brw_ENDIF(struct brw_compile *p, struct intel_context *intel = &p->brw->intel; GLuint br = 1; - if (intel->gen == 5) + if (intel->gen >= 5) br = 2; if (p->single_program_flow) { @@ -877,9 +925,15 @@ void brw_ENDIF(struct brw_compile *p, } else { struct brw_instruction *insn = next_insn(p, BRW_OPCODE_ENDIF); - brw_set_dest(insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_UD)); - brw_set_src0(insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_UD)); - brw_set_src1(insn, brw_imm_d(0x0)); + if (intel->gen < 6) { + brw_set_dest(insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_UD)); + brw_set_src0(insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_UD)); + brw_set_src1(insn, brw_imm_d(0x0)); + } else { + brw_set_dest(insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_W)); + brw_set_src0(insn, brw_null_reg()); + brw_set_src1(insn, brw_null_reg()); + } insn->header.compression_control = BRW_COMPRESSION_NONE; insn->header.execution_size = patch_insn->header.execution_size; @@ -892,25 +946,42 @@ void brw_ENDIF(struct brw_compile *p, * instruction respectively. */ if (patch_insn->header.opcode == BRW_OPCODE_IF) { - /* Automagically turn it into an IFF: - */ - patch_insn->header.opcode = BRW_OPCODE_IFF; - patch_insn->bits3.if_else.jump_count = br * (insn - patch_insn + 1); - patch_insn->bits3.if_else.pop_count = 0; - patch_insn->bits3.if_else.pad0 = 0; - } else if (patch_insn->header.opcode == BRW_OPCODE_ELSE) { - patch_insn->bits3.if_else.jump_count = br * (insn - patch_insn + 1); - patch_insn->bits3.if_else.pop_count = 1; - patch_insn->bits3.if_else.pad0 = 0; + if (intel->gen < 6) { + /* Turn it into an IFF, which means no mask stack operations for + * all-false and jumping past the ENDIF. + */ + patch_insn->header.opcode = BRW_OPCODE_IFF; + patch_insn->bits3.if_else.jump_count = br * (insn - patch_insn + 1); + patch_insn->bits3.if_else.pop_count = 0; + patch_insn->bits3.if_else.pad0 = 0; + } else { + /* As of gen6, there is no IFF and IF must point to the ENDIF. */ + patch_insn->bits1.branch_gen6.jump_count = br * (insn - patch_insn); + } } else { - assert(0); + assert(patch_insn->header.opcode == BRW_OPCODE_ELSE); + if (intel->gen < 6) { + /* BRW_OPCODE_ELSE pre-gen6 should point just past the + * matching ENDIF. + */ + patch_insn->bits3.if_else.jump_count = br * (insn - patch_insn + 1); + patch_insn->bits3.if_else.pop_count = 1; + patch_insn->bits3.if_else.pad0 = 0; + } else { + /* BRW_OPCODE_ELSE on gen6 should point to the matching ENDIF. */ + patch_insn->bits1.branch_gen6.jump_count = br * (insn - patch_insn); + } } /* Also pop item off the stack in the endif instruction: */ - insn->bits3.if_else.jump_count = 0; - insn->bits3.if_else.pop_count = 1; - insn->bits3.if_else.pad0 = 0; + if (intel->gen < 6) { + insn->bits3.if_else.jump_count = 0; + insn->bits3.if_else.pop_count = 1; + insn->bits3.if_else.pad0 = 0; + } else { + insn->bits1.branch_gen6.jump_count = 2; + } } } @@ -978,7 +1049,7 @@ struct brw_instruction *brw_WHILE(struct brw_compile *p, struct brw_instruction *insn; GLuint br = 1; - if (intel->gen == 5) + if (intel->gen >= 5) br = 2; if (p->single_program_flow) @@ -1022,7 +1093,7 @@ void brw_land_fwd_jump(struct brw_compile *p, struct brw_instruction *landing = &p->store[p->nr_insn]; GLuint jmpi = 1; - if (intel->gen == 5) + if (intel->gen >= 5) jmpi = 2; assert(jmp_insn->header.opcode == BRW_OPCODE_JMPI); @@ -1100,6 +1171,17 @@ void brw_math( struct brw_compile *p, if (intel->gen >= 6) { struct brw_instruction *insn = next_insn(p, BRW_OPCODE_MATH); + assert(dest.file == BRW_GENERAL_REGISTER_FILE); + assert(src.file == BRW_GENERAL_REGISTER_FILE); + + assert(dest.hstride == BRW_HORIZONTAL_STRIDE_1); + assert(src.hstride == BRW_HORIZONTAL_STRIDE_1); + + if (function != BRW_MATH_FUNCTION_INT_DIV_QUOTIENT && + function != BRW_MATH_FUNCTION_INT_DIV_QUOTIENT_AND_REMAINDER) { + assert(src.type == BRW_REGISTER_TYPE_F); + } + /* Math is the same ISA format as other opcodes, except that CondModifier * becomes FC[3:0] and ThreadCtrl becomes FC[5:4]. */ @@ -1131,6 +1213,45 @@ void brw_math( struct brw_compile *p, } } +/** Extended math function, float[8]. + */ +void brw_math2(struct brw_compile *p, + struct brw_reg dest, + GLuint function, + struct brw_reg src0, + struct brw_reg src1) +{ + struct intel_context *intel = &p->brw->intel; + struct brw_instruction *insn = next_insn(p, BRW_OPCODE_MATH); + + assert(intel->gen >= 6); + (void) intel; + + + assert(dest.file == BRW_GENERAL_REGISTER_FILE); + assert(src0.file == BRW_GENERAL_REGISTER_FILE); + assert(src1.file == BRW_GENERAL_REGISTER_FILE); + + assert(dest.hstride == BRW_HORIZONTAL_STRIDE_1); + assert(src0.hstride == BRW_HORIZONTAL_STRIDE_1); + assert(src1.hstride == BRW_HORIZONTAL_STRIDE_1); + + if (function != BRW_MATH_FUNCTION_INT_DIV_QUOTIENT && + function != BRW_MATH_FUNCTION_INT_DIV_QUOTIENT_AND_REMAINDER) { + assert(src0.type == BRW_REGISTER_TYPE_F); + assert(src1.type == BRW_REGISTER_TYPE_F); + } + + /* Math is the same ISA format as other opcodes, except that CondModifier + * becomes FC[3:0] and ThreadCtrl becomes FC[5:4]. + */ + insn->header.destreg__conditionalmod = function; + + brw_set_dest(insn, dest); + brw_set_src0(insn, src0); + brw_set_src1(insn, src1); +} + /** * Extended math function, float[16]. * Use 2 send instructions. @@ -1264,6 +1385,7 @@ void brw_dp_WRITE_16( struct brw_compile *p, BRW_DATAPORT_OWORD_BLOCK_4_OWORDS, /* msg_control */ BRW_DATAPORT_WRITE_MESSAGE_OWORD_BLOCK_WRITE, /* msg_type */ msg_length, + GL_TRUE, /* header_present */ 0, /* pixel scoreboard */ send_commit_msg, /* response_length */ 0, /* eot */ @@ -1501,12 +1623,16 @@ void brw_fb_WRITE(struct brw_compile *p, struct intel_context *intel = &p->brw->intel; struct brw_instruction *insn; GLuint msg_control, msg_type; + GLboolean header_present = GL_TRUE; insn = next_insn(p, BRW_OPCODE_SEND); insn->header.predicate_control = 0; /* XXX */ insn->header.compression_control = BRW_COMPRESSION_NONE; if (intel->gen >= 6) { + if (msg_length == 4) + header_present = GL_FALSE; + /* headerless version, just submit color payload */ src0 = brw_message_reg(msg_reg_nr); @@ -1530,6 +1656,7 @@ void brw_fb_WRITE(struct brw_compile *p, msg_control, msg_type, msg_length, + header_present, 1, /* pixel scoreboard */ response_length, eot, @@ -1556,6 +1683,7 @@ void brw_SAMPLE(struct brw_compile *p, GLuint header_present, GLuint simd_mode) { + struct intel_context *intel = &p->brw->intel; GLboolean need_stall = 0; if (writemask == 0) { @@ -1627,11 +1755,25 @@ void brw_SAMPLE(struct brw_compile *p, } { - struct brw_instruction *insn = next_insn(p, BRW_OPCODE_SEND); + struct brw_instruction *insn; + /* Sandybridge doesn't have the implied move for SENDs, + * and the first message register index comes from src0. + */ + if (intel->gen >= 6) { + brw_push_insn_state(p); + brw_set_mask_control( p, BRW_MASK_DISABLE ); + /* m1 contains header? */ + brw_MOV(p, brw_message_reg(msg_reg_nr), src0); + brw_pop_insn_state(p); + src0 = brw_message_reg(msg_reg_nr); + } + + insn = next_insn(p, BRW_OPCODE_SEND); insn->header.predicate_control = 0; /* XXX */ insn->header.compression_control = BRW_COMPRESSION_NONE; - insn->header.destreg__conditionalmod = msg_reg_nr; + if (intel->gen < 6) + insn->header.destreg__conditionalmod = msg_reg_nr; brw_set_dest(insn, dest); brw_set_src0(insn, src0); @@ -1721,13 +1863,28 @@ void brw_ff_sync(struct brw_compile *p, GLuint response_length, GLboolean eot) { - struct brw_instruction *insn = next_insn(p, BRW_OPCODE_SEND); + struct intel_context *intel = &p->brw->intel; + struct brw_instruction *insn; + /* Sandybridge doesn't have the implied move for SENDs, + * and the first message register index comes from src0. + */ + if (intel->gen >= 6) { + brw_push_insn_state(p); + brw_set_mask_control( p, BRW_MASK_DISABLE ); + brw_MOV(p, retype(brw_message_reg(msg_reg_nr), BRW_REGISTER_TYPE_UD), + retype(src0, BRW_REGISTER_TYPE_UD)); + brw_pop_insn_state(p); + src0 = brw_message_reg(msg_reg_nr); + } + + insn = next_insn(p, BRW_OPCODE_SEND); brw_set_dest(insn, dest); brw_set_src0(insn, src0); brw_set_src1(insn, brw_imm_d(0)); - insn->header.destreg__conditionalmod = msg_reg_nr; + if (intel->gen < 6) + insn->header.destreg__conditionalmod = msg_reg_nr; brw_set_ff_sync_message(p->brw, insn, diff --git a/src/mesa/drivers/dri/i965/brw_fallback.c b/src/mesa/drivers/dri/i965/brw_fallback.c index ba401c215c..6796fb208d 100644 --- a/src/mesa/drivers/dri/i965/brw_fallback.c +++ b/src/mesa/drivers/dri/i965/brw_fallback.c @@ -43,7 +43,7 @@ static GLboolean do_check_fallback(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; GLuint i; if (brw->intel.no_rast) { diff --git a/src/mesa/drivers/dri/i965/brw_fallback.h b/src/mesa/drivers/dri/i965/brw_fallback.h index 50dcdacd17..13b18b52e6 100644 --- a/src/mesa/drivers/dri/i965/brw_fallback.h +++ b/src/mesa/drivers/dri/i965/brw_fallback.h @@ -28,15 +28,15 @@ #ifndef BRW_FALLBACK_H #define BRW_FALLBACK_H -#include "main/mtypes.h" /* for GLcontext... */ +#include "main/mtypes.h" /* for struct gl_context... */ struct brw_context; struct vbo_prim; -void brw_fallback( GLcontext *ctx ); -void brw_unfallback( GLcontext *ctx ); +void brw_fallback( struct gl_context *ctx ); +void brw_unfallback( struct gl_context *ctx ); -void brw_loopback_vertex_list( GLcontext *ctx, +void brw_loopback_vertex_list( struct gl_context *ctx, const GLfloat *buffer, const GLubyte *attrsz, const struct vbo_prim *prim, diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index cf5c52119a..554ba39a0c 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -31,52 +31,27 @@ extern "C" { #include "main/macros.h" #include "main/shaderobj.h" +#include "main/uniforms.h" #include "program/prog_parameter.h" #include "program/prog_print.h" #include "program/prog_optimize.h" +#include "program/register_allocate.h" +#include "program/sampler.h" #include "program/hash_table.h" #include "brw_context.h" #include "brw_eu.h" #include "brw_wm.h" #include "talloc.h" } +#include "brw_fs.h" #include "../glsl/glsl_types.h" #include "../glsl/ir_optimization.h" #include "../glsl/ir_print_visitor.h" -enum register_file { - ARF = BRW_ARCHITECTURE_REGISTER_FILE, - GRF = BRW_GENERAL_REGISTER_FILE, - MRF = BRW_MESSAGE_REGISTER_FILE, - IMM = BRW_IMMEDIATE_VALUE, - FIXED_HW_REG, /* a struct brw_reg */ - UNIFORM, /* prog_data->params[hw_reg] */ - BAD_FILE -}; - -enum fs_opcodes { - FS_OPCODE_FB_WRITE = 256, - FS_OPCODE_RCP, - FS_OPCODE_RSQ, - FS_OPCODE_SQRT, - FS_OPCODE_EXP2, - FS_OPCODE_LOG2, - FS_OPCODE_POW, - FS_OPCODE_SIN, - FS_OPCODE_COS, - FS_OPCODE_DDX, - FS_OPCODE_DDY, - FS_OPCODE_LINTERP, - FS_OPCODE_TEX, - FS_OPCODE_TXB, - FS_OPCODE_TXL, - FS_OPCODE_DISCARD, -}; - -static int using_new_fs = -1; +static struct brw_reg brw_reg_from_fs_reg(class fs_reg *reg); struct gl_shader * -brw_new_shader(GLcontext *ctx, GLuint name, GLuint type) +brw_new_shader(struct gl_context *ctx, GLuint name, GLuint type) { struct brw_shader *shader; @@ -91,7 +66,7 @@ brw_new_shader(GLcontext *ctx, GLuint name, GLuint type) } struct gl_shader_program * -brw_new_shader_program(GLcontext *ctx, GLuint name) +brw_new_shader_program(struct gl_context *ctx, GLuint name) { struct brw_shader_program *prog; prog = talloc_zero(NULL, struct brw_shader_program); @@ -103,7 +78,7 @@ brw_new_shader_program(GLcontext *ctx, GLuint name) } GLboolean -brw_compile_shader(GLcontext *ctx, struct gl_shader *shader) +brw_compile_shader(struct gl_context *ctx, struct gl_shader *shader) { if (!_mesa_ir_compile_shader(ctx, shader)) return GL_FALSE; @@ -112,43 +87,60 @@ brw_compile_shader(GLcontext *ctx, struct gl_shader *shader) } GLboolean -brw_link_shader(GLcontext *ctx, struct gl_shader_program *prog) +brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) { - if (using_new_fs == -1) - using_new_fs = getenv("INTEL_NEW_FS") != NULL; - - for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { - struct brw_shader *shader = (struct brw_shader *)prog->_LinkedShaders[i]; - - if (using_new_fs && shader->base.Type == GL_FRAGMENT_SHADER) { - void *mem_ctx = talloc_new(NULL); - bool progress; - - if (shader->ir) - talloc_free(shader->ir); - shader->ir = new(shader) exec_list; - clone_ir_list(mem_ctx, shader->ir, shader->base.ir); - - do_mat_op_to_vec(shader->ir); - do_mod_to_fract(shader->ir); - do_div_to_mul_rcp(shader->ir); - do_sub_to_add_neg(shader->ir); - do_explog_to_explog2(shader->ir); + struct intel_context *intel = intel_context(ctx); + + struct brw_shader *shader = + (struct brw_shader *)prog->_LinkedShaders[MESA_SHADER_FRAGMENT]; + if (shader != NULL) { + void *mem_ctx = talloc_new(NULL); + bool progress; + + if (shader->ir) + talloc_free(shader->ir); + shader->ir = new(shader) exec_list; + clone_ir_list(mem_ctx, shader->ir, shader->base.ir); + + do_mat_op_to_vec(shader->ir); + do_mod_to_fract(shader->ir); + do_div_to_mul_rcp(shader->ir); + do_sub_to_add_neg(shader->ir); + do_explog_to_explog2(shader->ir); + do_lower_texture_projection(shader->ir); + brw_do_cubemap_normalize(shader->ir); + + do { + progress = false; brw_do_channel_expressions(shader->ir); brw_do_vector_splitting(shader->ir); - do { - progress = false; - - progress = do_common_optimization(shader->ir, true, 32) || progress; - } while (progress); + progress = do_lower_jumps(shader->ir, true, true, + true, /* main return */ + false, /* continue */ + false /* loops */ + ) || progress; + + progress = do_common_optimization(shader->ir, true, 32) || progress; + + progress = lower_noise(shader->ir) || progress; + progress = + lower_variable_index_to_cond_assign(shader->ir, + GL_TRUE, /* input */ + GL_TRUE, /* output */ + GL_TRUE, /* temp */ + GL_TRUE /* uniform */ + ) || progress; + if (intel->gen == 6) { + progress = do_if_to_cond_assign(shader->ir) || progress; + } + } while (progress); - validate_ir_tree(shader->ir); + validate_ir_tree(shader->ir); - reparent_ir(shader->ir, shader->ir); - talloc_free(mem_ctx); - } + reparent_ir(shader->ir, shader->ir); + talloc_free(mem_ctx); } if (!_mesa_ir_link_shader(ctx, prog)) @@ -169,7 +161,6 @@ type_size(const struct glsl_type *type) case GLSL_TYPE_BOOL: return type->components(); case GLSL_TYPE_ARRAY: - /* FINISHME: uniform/varying arrays. */ return type_size(type->fields.array) * type->length; case GLSL_TYPE_STRUCT: size = 0; @@ -188,331 +179,415 @@ type_size(const struct glsl_type *type) } } -class fs_reg { -public: - /* Callers of this talloc-based new need not call delete. It's - * easier to just talloc_free 'ctx' (or any of its ancestors). */ - static void* operator new(size_t size, void *ctx) - { - void *node; - - node = talloc_size(ctx, size); - assert(node != NULL); - - return node; - } - - void init() - { - this->reg = 0; - this->reg_offset = 0; - this->negate = 0; - this->abs = 0; - this->hw_reg = -1; - } - - /** Generic unset register constructor. */ - fs_reg() - { - init(); - this->file = BAD_FILE; - } - - /** Immediate value constructor. */ - fs_reg(float f) - { - init(); - this->file = IMM; - this->type = BRW_REGISTER_TYPE_F; - this->imm.f = f; - } - - /** Immediate value constructor. */ - fs_reg(int32_t i) - { - init(); - this->file = IMM; - this->type = BRW_REGISTER_TYPE_D; - this->imm.i = i; - } - - /** Immediate value constructor. */ - fs_reg(uint32_t u) - { - init(); - this->file = IMM; - this->type = BRW_REGISTER_TYPE_UD; - this->imm.u = u; - } - - /** Fixed brw_reg Immediate value constructor. */ - fs_reg(struct brw_reg fixed_hw_reg) - { - init(); - this->file = FIXED_HW_REG; - this->fixed_hw_reg = fixed_hw_reg; - this->type = fixed_hw_reg.type; - } - - fs_reg(enum register_file file, int hw_reg); - fs_reg(class fs_visitor *v, const struct glsl_type *type); - - /** Register file: ARF, GRF, MRF, IMM. */ - enum register_file file; - /** Abstract register number. 0 = fixed hw reg */ - int reg; - /** Offset within the abstract register. */ - int reg_offset; - /** HW register number. Generally unset until register allocation. */ - int hw_reg; - /** Register type. BRW_REGISTER_TYPE_* */ - int type; - bool negate; - bool abs; - struct brw_reg fixed_hw_reg; - - /** Value for file == BRW_IMMMEDIATE_FILE */ - union { - int32_t i; - uint32_t u; - float f; - } imm; -}; - static const fs_reg reg_undef; -static const fs_reg reg_null(ARF, BRW_ARF_NULL); +static const fs_reg reg_null_f(ARF, BRW_ARF_NULL, BRW_REGISTER_TYPE_F); +static const fs_reg reg_null_d(ARF, BRW_ARF_NULL, BRW_REGISTER_TYPE_D); + +int +fs_visitor::virtual_grf_alloc(int size) +{ + if (virtual_grf_array_size <= virtual_grf_next) { + if (virtual_grf_array_size == 0) + virtual_grf_array_size = 16; + else + virtual_grf_array_size *= 2; + virtual_grf_sizes = talloc_realloc(mem_ctx, virtual_grf_sizes, + int, virtual_grf_array_size); + + /* This slot is always unused. */ + virtual_grf_sizes[0] = 0; + } + virtual_grf_sizes[virtual_grf_next] = size; + return virtual_grf_next++; +} + +/** Fixed HW reg constructor. */ +fs_reg::fs_reg(enum register_file file, int hw_reg) +{ + init(); + this->file = file; + this->hw_reg = hw_reg; + this->type = BRW_REGISTER_TYPE_F; +} + +/** Fixed HW reg constructor. */ +fs_reg::fs_reg(enum register_file file, int hw_reg, uint32_t type) +{ + init(); + this->file = file; + this->hw_reg = hw_reg; + this->type = type; +} + +int +brw_type_for_base_type(const struct glsl_type *type) +{ + switch (type->base_type) { + case GLSL_TYPE_FLOAT: + return BRW_REGISTER_TYPE_F; + case GLSL_TYPE_INT: + case GLSL_TYPE_BOOL: + return BRW_REGISTER_TYPE_D; + case GLSL_TYPE_UINT: + return BRW_REGISTER_TYPE_UD; + case GLSL_TYPE_ARRAY: + case GLSL_TYPE_STRUCT: + /* These should be overridden with the type of the member when + * dereferenced into. BRW_REGISTER_TYPE_UD seems like a likely + * way to trip up if we don't. + */ + return BRW_REGISTER_TYPE_UD; + default: + assert(!"not reached"); + return BRW_REGISTER_TYPE_F; + } +} + +/** Automatic reg constructor. */ +fs_reg::fs_reg(class fs_visitor *v, const struct glsl_type *type) +{ + init(); -class fs_inst : public exec_node { -public: - /* Callers of this talloc-based new need not call delete. It's - * easier to just talloc_free 'ctx' (or any of its ancestors). */ - static void* operator new(size_t size, void *ctx) - { - void *node; + this->file = GRF; + this->reg = v->virtual_grf_alloc(type_size(type)); + this->reg_offset = 0; + this->type = brw_type_for_base_type(type); +} + +fs_reg * +fs_visitor::variable_storage(ir_variable *var) +{ + return (fs_reg *)hash_table_find(this->variable_ht, var); +} + +/* Our support for uniforms is piggy-backed on the struct + * gl_fragment_program, because that's where the values actually + * get stored, rather than in some global gl_shader_program uniform + * store. + */ +int +fs_visitor::setup_uniform_values(int loc, const glsl_type *type) +{ + unsigned int offset = 0; + float *vec_values; - node = talloc_zero_size(ctx, size); - assert(node != NULL); + if (type->is_matrix()) { + const glsl_type *column = glsl_type::get_instance(GLSL_TYPE_FLOAT, + type->vector_elements, + 1); - return node; + for (unsigned int i = 0; i < type->matrix_columns; i++) { + offset += setup_uniform_values(loc + offset, column); + } + + return offset; } - void init() - { - this->opcode = BRW_OPCODE_NOP; - this->saturate = false; - this->conditional_mod = BRW_CONDITIONAL_NONE; - this->predicated = false; - this->sampler = 0; - this->shadow_compare = false; + switch (type->base_type) { + case GLSL_TYPE_FLOAT: + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + case GLSL_TYPE_BOOL: + vec_values = fp->Base.Parameters->ParameterValues[loc]; + for (unsigned int i = 0; i < type->vector_elements; i++) { + c->prog_data.param[c->prog_data.nr_params++] = &vec_values[i]; + } + return 1; + + case GLSL_TYPE_STRUCT: + for (unsigned int i = 0; i < type->length; i++) { + offset += setup_uniform_values(loc + offset, + type->fields.structure[i].type); + } + return offset; + + case GLSL_TYPE_ARRAY: + for (unsigned int i = 0; i < type->length; i++) { + offset += setup_uniform_values(loc + offset, type->fields.array); + } + return offset; + + case GLSL_TYPE_SAMPLER: + /* The sampler takes up a slot, but we don't use any values from it. */ + return 1; + + default: + assert(!"not reached"); + return 0; } +} + - fs_inst() - { - init(); +/* Our support for builtin uniforms is even scarier than non-builtin. + * It sits on top of the PROG_STATE_VAR parameters that are + * automatically updated from GL context state. + */ +void +fs_visitor::setup_builtin_uniform_values(ir_variable *ir) +{ + const struct gl_builtin_uniform_desc *statevar = NULL; + + for (unsigned int i = 0; _mesa_builtin_uniform_desc[i].name; i++) { + statevar = &_mesa_builtin_uniform_desc[i]; + if (strcmp(ir->name, _mesa_builtin_uniform_desc[i].name) == 0) + break; } - fs_inst(int opcode) - { - init(); - this->opcode = opcode; + if (!statevar->name) { + this->fail = true; + printf("Failed to find builtin uniform `%s'\n", ir->name); + return; } - fs_inst(int opcode, fs_reg dst, fs_reg src0) - { - init(); - this->opcode = opcode; - this->dst = dst; - this->src[0] = src0; + int array_count; + if (ir->type->is_array()) { + array_count = ir->type->length; + } else { + array_count = 1; } - fs_inst(int opcode, fs_reg dst, fs_reg src0, fs_reg src1) - { - init(); - this->opcode = opcode; - this->dst = dst; - this->src[0] = src0; - this->src[1] = src1; + for (int a = 0; a < array_count; a++) { + for (unsigned int i = 0; i < statevar->num_elements; i++) { + struct gl_builtin_uniform_element *element = &statevar->elements[i]; + int tokens[STATE_LENGTH]; + + memcpy(tokens, element->tokens, sizeof(element->tokens)); + if (ir->type->is_array()) { + tokens[1] = a; + } + + /* This state reference has already been setup by ir_to_mesa, + * but we'll get the same index back here. + */ + int index = _mesa_add_state_reference(this->fp->Base.Parameters, + (gl_state_index *)tokens); + float *vec_values = this->fp->Base.Parameters->ParameterValues[index]; + + /* Add each of the unique swizzles of the element as a + * parameter. This'll end up matching the expected layout of + * the array/matrix/structure we're trying to fill in. + */ + int last_swiz = -1; + for (unsigned int i = 0; i < 4; i++) { + int swiz = GET_SWZ(element->swizzle, i); + if (swiz == last_swiz) + break; + last_swiz = swiz; + + c->prog_data.param[c->prog_data.nr_params++] = &vec_values[swiz]; + } + } } +} - fs_inst(int opcode, fs_reg dst, fs_reg src0, fs_reg src1, fs_reg src2) - { - init(); - this->opcode = opcode; - this->dst = dst; - this->src[0] = src0; - this->src[1] = src1; - this->src[2] = src2; +fs_reg * +fs_visitor::emit_fragcoord_interpolation(ir_variable *ir) +{ + fs_reg *reg = new(this->mem_ctx) fs_reg(this, ir->type); + fs_reg wpos = *reg; + fs_reg neg_y = this->pixel_y; + neg_y.negate = true; + + /* gl_FragCoord.x */ + if (ir->pixel_center_integer) { + emit(fs_inst(BRW_OPCODE_MOV, wpos, this->pixel_x)); + } else { + emit(fs_inst(BRW_OPCODE_ADD, wpos, this->pixel_x, fs_reg(0.5f))); } + wpos.reg_offset++; - int opcode; /* BRW_OPCODE_* or FS_OPCODE_* */ - fs_reg dst; - fs_reg src[3]; - bool saturate; - bool predicated; - int conditional_mod; /**< BRW_CONDITIONAL_* */ + /* gl_FragCoord.y */ + if (ir->origin_upper_left && ir->pixel_center_integer) { + emit(fs_inst(BRW_OPCODE_MOV, wpos, this->pixel_y)); + } else { + fs_reg pixel_y = this->pixel_y; + float offset = (ir->pixel_center_integer ? 0.0 : 0.5); - int mlen; /** SEND message length */ - int sampler; - bool shadow_compare; + if (!ir->origin_upper_left) { + pixel_y.negate = true; + offset += c->key.drawable_height - 1.0; + } - /** @{ - * Annotation for the generated IR. One of the two can be set. - */ - ir_instruction *ir; - const char *annotation; - /** @} */ -}; - -class fs_visitor : public ir_visitor -{ -public: - - fs_visitor(struct brw_wm_compile *c, struct brw_shader *shader) - { - this->c = c; - this->p = &c->func; - this->brw = p->brw; - this->intel = &brw->intel; - this->ctx = &intel->ctx; - this->mem_ctx = talloc_new(NULL); - this->shader = shader; - this->fail = false; - this->next_abstract_grf = 1; - this->variable_ht = hash_table_ctor(0, - hash_table_pointer_hash, - hash_table_pointer_compare); - - this->frag_color = NULL; - this->frag_data = NULL; - this->frag_depth = NULL; - this->first_non_payload_grf = 0; - - this->current_annotation = NULL; - this->annotation_string = NULL; - this->annotation_ir = NULL; - } - ~fs_visitor() - { - talloc_free(this->mem_ctx); - hash_table_dtor(this->variable_ht); - } - - fs_reg *variable_storage(ir_variable *var); - - void visit(ir_variable *ir); - void visit(ir_assignment *ir); - void visit(ir_dereference_variable *ir); - void visit(ir_dereference_record *ir); - void visit(ir_dereference_array *ir); - void visit(ir_expression *ir); - void visit(ir_texture *ir); - void visit(ir_if *ir); - void visit(ir_constant *ir); - void visit(ir_swizzle *ir); - void visit(ir_return *ir); - void visit(ir_loop *ir); - void visit(ir_loop_jump *ir); - void visit(ir_discard *ir); - void visit(ir_call *ir); - void visit(ir_function *ir); - void visit(ir_function_signature *ir); - - fs_inst *emit(fs_inst inst); - void assign_curb_setup(); - void assign_urb_setup(); - void assign_regs(); - void generate_code(); - void generate_fb_write(fs_inst *inst); - void generate_linterp(fs_inst *inst, struct brw_reg dst, - struct brw_reg *src); - void generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src); - void generate_math(fs_inst *inst, struct brw_reg dst, struct brw_reg *src); - void generate_discard(fs_inst *inst); - - void emit_dummy_fs(); - void emit_interpolation(); - void emit_pinterp(int location); - void emit_fb_writes(); - - struct brw_reg interp_reg(int location, int channel); - - struct brw_context *brw; - struct intel_context *intel; - GLcontext *ctx; - struct brw_wm_compile *c; - struct brw_compile *p; - struct brw_shader *shader; - void *mem_ctx; - exec_list instructions; - int next_abstract_grf; - struct hash_table *variable_ht; - ir_variable *frag_color, *frag_data, *frag_depth; - int first_non_payload_grf; - - /** @{ debug annotation info */ - const char *current_annotation; - ir_instruction *base_ir; - const char **annotation_string; - ir_instruction **annotation_ir; - /** @} */ - - bool fail; - - /* Result of last visit() method. */ - fs_reg result; + emit(fs_inst(BRW_OPCODE_ADD, wpos, pixel_y, fs_reg(offset))); + } + wpos.reg_offset++; - fs_reg pixel_x; - fs_reg pixel_y; - fs_reg pixel_w; - fs_reg delta_x; - fs_reg delta_y; - fs_reg interp_attrs[64]; + /* gl_FragCoord.z */ + emit(fs_inst(FS_OPCODE_LINTERP, wpos, this->delta_x, this->delta_y, + interp_reg(FRAG_ATTRIB_WPOS, 2))); + wpos.reg_offset++; - int grf_used; + /* gl_FragCoord.w: Already set up in emit_interpolation */ + emit(fs_inst(BRW_OPCODE_MOV, wpos, this->wpos_w)); -}; + return reg; +} -/** Fixed HW reg constructor. */ -fs_reg::fs_reg(enum register_file file, int hw_reg) +fs_reg * +fs_visitor::emit_general_interpolation(ir_variable *ir) { - init(); - this->file = file; - this->hw_reg = hw_reg; - this->type = BRW_REGISTER_TYPE_F; + fs_reg *reg = new(this->mem_ctx) fs_reg(this, ir->type); + /* Interpolation is always in floating point regs. */ + reg->type = BRW_REGISTER_TYPE_F; + fs_reg attr = *reg; + + unsigned int array_elements; + const glsl_type *type; + + if (ir->type->is_array()) { + array_elements = ir->type->length; + if (array_elements == 0) { + this->fail = true; + } + type = ir->type->fields.array; + } else { + array_elements = 1; + type = ir->type; + } + + int location = ir->location; + for (unsigned int i = 0; i < array_elements; i++) { + for (unsigned int j = 0; j < type->matrix_columns; j++) { + if (urb_setup[location] == -1) { + /* If there's no incoming setup data for this slot, don't + * emit interpolation for it. + */ + attr.reg_offset += type->vector_elements; + location++; + continue; + } + + for (unsigned int c = 0; c < type->vector_elements; c++) { + struct brw_reg interp = interp_reg(location, c); + emit(fs_inst(FS_OPCODE_LINTERP, + attr, + this->delta_x, + this->delta_y, + fs_reg(interp))); + attr.reg_offset++; + } + + if (intel->gen < 6) { + attr.reg_offset -= type->vector_elements; + for (unsigned int c = 0; c < type->vector_elements; c++) { + emit(fs_inst(BRW_OPCODE_MUL, + attr, + attr, + this->pixel_w)); + attr.reg_offset++; + } + } + location++; + } + } + + return reg; } -/** Automatic reg constructor. */ -fs_reg::fs_reg(class fs_visitor *v, const struct glsl_type *type) +fs_reg * +fs_visitor::emit_frontfacing_interpolation(ir_variable *ir) { - init(); + fs_reg *reg = new(this->mem_ctx) fs_reg(this, ir->type); + + /* The frontfacing comes in as a bit in the thread payload. */ + if (intel->gen >= 6) { + emit(fs_inst(BRW_OPCODE_ASR, + *reg, + fs_reg(retype(brw_vec1_grf(0, 0), BRW_REGISTER_TYPE_D)), + fs_reg(15))); + emit(fs_inst(BRW_OPCODE_NOT, + *reg, + *reg)); + emit(fs_inst(BRW_OPCODE_AND, + *reg, + *reg, + fs_reg(1))); + } else { + fs_reg *reg = new(this->mem_ctx) fs_reg(this, ir->type); + struct brw_reg r1_6ud = retype(brw_vec1_grf(1, 6), BRW_REGISTER_TYPE_UD); + /* bit 31 is "primitive is back face", so checking < (1 << 31) gives + * us front face + */ + fs_inst *inst = emit(fs_inst(BRW_OPCODE_CMP, + *reg, + fs_reg(r1_6ud), + fs_reg(1u << 31))); + inst->conditional_mod = BRW_CONDITIONAL_L; + emit(fs_inst(BRW_OPCODE_AND, *reg, *reg, fs_reg(1u))); + } - this->file = GRF; - this->reg = v->next_abstract_grf; - this->reg_offset = 0; - v->next_abstract_grf += type_size(type); + return reg; +} - switch (type->base_type) { - case GLSL_TYPE_FLOAT: - this->type = BRW_REGISTER_TYPE_F; - break; - case GLSL_TYPE_INT: - case GLSL_TYPE_BOOL: - this->type = BRW_REGISTER_TYPE_D; - break; - case GLSL_TYPE_UINT: - this->type = BRW_REGISTER_TYPE_UD; +fs_inst * +fs_visitor::emit_math(fs_opcodes opcode, fs_reg dst, fs_reg src) +{ + switch (opcode) { + case FS_OPCODE_RCP: + case FS_OPCODE_RSQ: + case FS_OPCODE_SQRT: + case FS_OPCODE_EXP2: + case FS_OPCODE_LOG2: + case FS_OPCODE_SIN: + case FS_OPCODE_COS: break; default: - assert(!"not reached"); - this->type = BRW_REGISTER_TYPE_F; - break; + assert(!"not reached: bad math opcode"); + return NULL; } + + /* Can't do hstride == 0 args to gen6 math, so expand it out. We + * might be able to do better by doing execsize = 1 math and then + * expanding that result out, but we would need to be careful with + * masking. + */ + if (intel->gen >= 6 && src.file == UNIFORM) { + fs_reg expanded = fs_reg(this, glsl_type::float_type); + emit(fs_inst(BRW_OPCODE_MOV, expanded, src)); + src = expanded; + } + + fs_inst *inst = emit(fs_inst(opcode, dst, src)); + + if (intel->gen < 6) { + inst->base_mrf = 2; + inst->mlen = 1; + } + + return inst; } -fs_reg * -fs_visitor::variable_storage(ir_variable *var) +fs_inst * +fs_visitor::emit_math(fs_opcodes opcode, fs_reg dst, fs_reg src0, fs_reg src1) { - return (fs_reg *)hash_table_find(this->variable_ht, var); + int base_mrf = 2; + fs_inst *inst; + + assert(opcode == FS_OPCODE_POW); + + if (intel->gen >= 6) { + /* Can't do hstride == 0 args to gen6 math, so expand it out. */ + if (src0.file == UNIFORM) { + fs_reg expanded = fs_reg(this, glsl_type::float_type); + emit(fs_inst(BRW_OPCODE_MOV, expanded, src0)); + src0 = expanded; + } + + if (src1.file == UNIFORM) { + fs_reg expanded = fs_reg(this, glsl_type::float_type); + emit(fs_inst(BRW_OPCODE_MOV, expanded, src1)); + src1 = expanded; + } + + inst = emit(fs_inst(opcode, dst, src0, src1)); + } else { + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + 1), src1)); + inst = emit(fs_inst(opcode, dst, src0, reg_null_f)); + + inst->base_mrf = base_mrf; + inst->mlen = 2; + } + return inst; } void @@ -520,36 +595,37 @@ fs_visitor::visit(ir_variable *ir) { fs_reg *reg = NULL; + if (variable_storage(ir)) + return; + if (strcmp(ir->name, "gl_FragColor") == 0) { this->frag_color = ir; } else if (strcmp(ir->name, "gl_FragData") == 0) { this->frag_data = ir; } else if (strcmp(ir->name, "gl_FragDepth") == 0) { this->frag_depth = ir; - assert(!"FINISHME: this hangs currently."); } if (ir->mode == ir_var_in) { - reg = &this->interp_attrs[ir->location]; + if (!strcmp(ir->name, "gl_FragCoord")) { + reg = emit_fragcoord_interpolation(ir); + } else if (!strcmp(ir->name, "gl_FrontFacing")) { + reg = emit_frontfacing_interpolation(ir); + } else { + reg = emit_general_interpolation(ir); + } + assert(reg); + hash_table_insert(this->variable_ht, reg, ir); + return; } if (ir->mode == ir_var_uniform) { - const float *vec_values; int param_index = c->prog_data.nr_params; - /* FINISHME: This is wildly incomplete. */ - assert(ir->type->is_scalar() || ir->type->is_vector() || - ir->type->is_sampler()); - - const struct gl_program *fp = &this->brw->fragment_program->Base; - /* Our support for uniforms is piggy-backed on the struct - * gl_fragment_program, because that's where the values actually - * get stored, rather than in some global gl_shader_program uniform - * store. - */ - vec_values = fp->Parameters->ParameterValues[ir->location]; - for (unsigned int i = 0; i < ir->type->vector_elements; i++) { - c->prog_data.param[c->prog_data.nr_params++] = &vec_values[i]; + if (!strncmp(ir->name, "gl_", 3)) { + setup_builtin_uniform_values(ir); + } else { + setup_uniform_values(ir->location, ir->type); } reg = new(this->mem_ctx) fs_reg(UNIFORM, param_index); @@ -571,7 +647,18 @@ fs_visitor::visit(ir_dereference_variable *ir) void fs_visitor::visit(ir_dereference_record *ir) { - assert(!"FINISHME"); + const glsl_type *struct_type = ir->record->type; + + ir->record->accept(this); + + unsigned int offset = 0; + for (unsigned int i = 0; i < struct_type->length; i++) { + if (strcmp(struct_type->fields.structure[i].name, ir->field) == 0) + break; + offset += type_size(struct_type->fields.structure[i].type); + } + this->result.reg_offset += offset; + this->result.type = brw_type_for_base_type(ir->type); } void @@ -583,11 +670,8 @@ fs_visitor::visit(ir_dereference_array *ir) ir->array->accept(this); index = ir->array_index->as_constant(); - if (ir->type->is_matrix()) { - element_size = ir->type->vector_elements; - } else { - element_size = type_size(ir->type); - } + element_size = type_size(ir->type); + this->result.type = brw_type_for_base_type(ir->type); if (index) { assert(this->result.file == UNIFORM || @@ -595,7 +679,7 @@ fs_visitor::visit(ir_dereference_array *ir) this->result.reg != 0)); this->result.reg_offset += index->value.i[0] * element_size; } else { - assert(!"FINISHME: non-constant matrix column"); + assert(!"FINISHME: non-constant array element"); } } @@ -633,10 +717,13 @@ fs_visitor::visit(ir_expression *ir) switch (ir->operation) { case ir_unop_logic_not: + /* Note that BRW_OPCODE_NOT is not appropriate here, since it is + * ones complement of the whole register, not just bit 0. + */ emit(fs_inst(BRW_OPCODE_ADD, this->result, op[0], fs_reg(-1))); break; case ir_unop_neg: - op[0].negate = ~op[0].negate; + op[0].negate = !op[0].negate; this->result = op[0]; break; case ir_unop_abs: @@ -648,36 +735,36 @@ fs_visitor::visit(ir_expression *ir) emit(fs_inst(BRW_OPCODE_MOV, this->result, fs_reg(0.0f))); - inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null, op[0], fs_reg(0.0f))); + inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_f, op[0], fs_reg(0.0f))); inst->conditional_mod = BRW_CONDITIONAL_G; inst = emit(fs_inst(BRW_OPCODE_MOV, this->result, fs_reg(1.0f))); inst->predicated = true; - inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null, op[0], fs_reg(0.0f))); + inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_f, op[0], fs_reg(0.0f))); inst->conditional_mod = BRW_CONDITIONAL_L; inst = emit(fs_inst(BRW_OPCODE_MOV, this->result, fs_reg(-1.0f))); inst->predicated = true; break; case ir_unop_rcp: - emit(fs_inst(FS_OPCODE_RCP, this->result, op[0])); + emit_math(FS_OPCODE_RCP, this->result, op[0]); break; case ir_unop_exp2: - emit(fs_inst(FS_OPCODE_EXP2, this->result, op[0])); + emit_math(FS_OPCODE_EXP2, this->result, op[0]); break; case ir_unop_log2: - emit(fs_inst(FS_OPCODE_LOG2, this->result, op[0])); + emit_math(FS_OPCODE_LOG2, this->result, op[0]); break; case ir_unop_exp: case ir_unop_log: assert(!"not reached: should be handled by ir_explog_to_explog2"); break; case ir_unop_sin: - emit(fs_inst(FS_OPCODE_SIN, this->result, op[0])); + emit_math(FS_OPCODE_SIN, this->result, op[0]); break; case ir_unop_cos: - emit(fs_inst(FS_OPCODE_COS, this->result, op[0])); + emit_math(FS_OPCODE_COS, this->result, op[0]); break; case ir_unop_dFdx: @@ -725,11 +812,13 @@ fs_visitor::visit(ir_expression *ir) emit(fs_inst(BRW_OPCODE_AND, this->result, this->result, fs_reg(0x1))); break; case ir_binop_equal: + case ir_binop_all_equal: /* same as nequal for scalars */ inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], op[1])); inst->conditional_mod = BRW_CONDITIONAL_Z; emit(fs_inst(BRW_OPCODE_AND, this->result, this->result, fs_reg(0x1))); break; case ir_binop_nequal: + case ir_binop_any_nequal: /* same as nequal for scalars */ inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], op[1])); inst->conditional_mod = BRW_CONDITIONAL_NZ; emit(fs_inst(BRW_OPCODE_AND, this->result, this->result, fs_reg(0x1))); @@ -750,7 +839,7 @@ fs_visitor::visit(ir_expression *ir) case ir_binop_dot: case ir_binop_cross: case ir_unop_any: - assert(!"not reached: should be handled by brw_channel_expressions"); + assert(!"not reached: should be handled by brw_fs_channel_expressions"); break; case ir_unop_noise: @@ -758,18 +847,16 @@ fs_visitor::visit(ir_expression *ir) break; case ir_unop_sqrt: - emit(fs_inst(FS_OPCODE_SQRT, this->result, op[0])); + emit_math(FS_OPCODE_SQRT, this->result, op[0]); break; case ir_unop_rsq: - emit(fs_inst(FS_OPCODE_RSQ, this->result, op[0])); + emit_math(FS_OPCODE_RSQ, this->result, op[0]); break; case ir_unop_i2f: case ir_unop_b2f: case ir_unop_b2i: - emit(fs_inst(BRW_OPCODE_MOV, this->result, op[0])); - break; case ir_unop_f2i: emit(fs_inst(BRW_OPCODE_MOV, this->result, op[0])); break; @@ -777,12 +864,15 @@ fs_visitor::visit(ir_expression *ir) case ir_unop_i2b: inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], fs_reg(0.0f))); inst->conditional_mod = BRW_CONDITIONAL_NZ; + inst = emit(fs_inst(BRW_OPCODE_AND, this->result, + this->result, fs_reg(1))); + break; case ir_unop_trunc: - emit(fs_inst(BRW_OPCODE_RNDD, this->result, op[0])); + emit(fs_inst(BRW_OPCODE_RNDZ, this->result, op[0])); break; case ir_unop_ceil: - op[0].negate = ~op[0].negate; + op[0].negate = !op[0].negate; inst = emit(fs_inst(BRW_OPCODE_RNDD, this->result, op[0])); this->result.negate = true; break; @@ -792,6 +882,9 @@ fs_visitor::visit(ir_expression *ir) case ir_unop_fract: inst = emit(fs_inst(BRW_OPCODE_FRC, this->result, op[0])); break; + case ir_unop_round_even: + emit(fs_inst(BRW_OPCODE_RNDE, this->result, op[0])); + break; case ir_binop_min: inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], op[1])); @@ -809,7 +902,7 @@ fs_visitor::visit(ir_expression *ir) break; case ir_binop_pow: - inst = emit(fs_inst(FS_OPCODE_POW, this->result, op[0], op[1])); + emit_math(FS_OPCODE_POW, this->result, op[0], op[1]); break; case ir_unop_bit_not: @@ -825,11 +918,50 @@ fs_visitor::visit(ir_expression *ir) } void +fs_visitor::emit_assignment_writes(fs_reg &l, fs_reg &r, + const glsl_type *type, bool predicated) +{ + switch (type->base_type) { + case GLSL_TYPE_FLOAT: + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + case GLSL_TYPE_BOOL: + for (unsigned int i = 0; i < type->components(); i++) { + l.type = brw_type_for_base_type(type); + r.type = brw_type_for_base_type(type); + + fs_inst *inst = emit(fs_inst(BRW_OPCODE_MOV, l, r)); + inst->predicated = predicated; + + l.reg_offset++; + r.reg_offset++; + } + break; + case GLSL_TYPE_ARRAY: + for (unsigned int i = 0; i < type->length; i++) { + emit_assignment_writes(l, r, type->fields.array, predicated); + } + + case GLSL_TYPE_STRUCT: + for (unsigned int i = 0; i < type->length; i++) { + emit_assignment_writes(l, r, type->fields.structure[i].type, + predicated); + } + break; + + case GLSL_TYPE_SAMPLER: + break; + + default: + assert(!"not reached"); + break; + } +} + +void fs_visitor::visit(ir_assignment *ir) { struct fs_reg l, r; - int i; - int write_mask; fs_inst *inst; /* FINISHME: arrays on the lhs */ @@ -839,118 +971,300 @@ fs_visitor::visit(ir_assignment *ir) ir->rhs->accept(this); r = this->result; - /* FINISHME: This should really set to the correct maximal writemask for each - * FINISHME: component written (in the loops below). This case can only - * FINISHME: occur for matrices, arrays, and structures. - */ - if (ir->write_mask == 0) { - assert(!ir->lhs->type->is_scalar() && !ir->lhs->type->is_vector()); - write_mask = WRITEMASK_XYZW; - } else { - assert(ir->lhs->type->is_vector() || ir->lhs->type->is_scalar()); - write_mask = ir->write_mask; - } - assert(l.file != BAD_FILE); assert(r.file != BAD_FILE); if (ir->condition) { - /* Get the condition bool into the predicate. */ - ir->condition->accept(this); - inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, fs_reg(0))); - inst->conditional_mod = BRW_CONDITIONAL_NZ; + emit_bool_to_cond_code(ir->condition); } - for (i = 0; i < type_size(ir->lhs->type); i++) { - if (i >= 4 || (write_mask & (1 << i))) { - inst = emit(fs_inst(BRW_OPCODE_MOV, l, r)); - if (ir->condition) - inst->predicated = true; + if (ir->lhs->type->is_scalar() || + ir->lhs->type->is_vector()) { + for (int i = 0; i < ir->lhs->type->vector_elements; i++) { + if (ir->write_mask & (1 << i)) { + inst = emit(fs_inst(BRW_OPCODE_MOV, l, r)); + if (ir->condition) + inst->predicated = true; + r.reg_offset++; + } + l.reg_offset++; } - l.reg_offset++; - r.reg_offset++; + } else { + emit_assignment_writes(l, r, ir->lhs->type, ir->condition != NULL); } } -void -fs_visitor::visit(ir_texture *ir) +fs_inst * +fs_visitor::emit_texture_gen4(ir_texture *ir, fs_reg dst, fs_reg coordinate) { - int base_mrf = 2; - fs_inst *inst = NULL; - unsigned int mlen = 0; + int mlen; + int base_mrf = 1; + bool simd16 = false; + fs_reg orig_dst; - ir->coordinate->accept(this); - fs_reg coordinate = this->result; + /* g0 header. */ + mlen = 1; - if (ir->projector) { - fs_reg inv_proj = fs_reg(this, glsl_type::float_type); + if (ir->shadow_comparitor) { + for (int i = 0; i < ir->coordinate->type->vector_elements; i++) { + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen + i), + coordinate)); + coordinate.reg_offset++; + } + /* gen4's SIMD8 sampler always has the slots for u,v,r present. */ + mlen += 3; - ir->projector->accept(this); - emit(fs_inst(FS_OPCODE_RCP, inv_proj, this->result)); + if (ir->op == ir_tex) { + /* There's no plain shadow compare message, so we use shadow + * compare with a bias of 0.0. + */ + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), + fs_reg(0.0f))); + mlen++; + } else if (ir->op == ir_txb) { + ir->lod_info.bias->accept(this); + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), + this->result)); + mlen++; + } else { + assert(ir->op == ir_txl); + ir->lod_info.lod->accept(this); + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), + this->result)); + mlen++; + } - fs_reg proj_coordinate = fs_reg(this, ir->coordinate->type); - for (unsigned int i = 0; i < ir->coordinate->type->vector_elements; i++) { - emit(fs_inst(BRW_OPCODE_MUL, proj_coordinate, coordinate, inv_proj)); + ir->shadow_comparitor->accept(this); + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), this->result)); + mlen++; + } else if (ir->op == ir_tex) { + for (int i = 0; i < ir->coordinate->type->vector_elements; i++) { + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen + i), + coordinate)); coordinate.reg_offset++; - proj_coordinate.reg_offset++; } - proj_coordinate.reg_offset = 0; + /* gen4's SIMD8 sampler always has the slots for u,v,r present. */ + mlen += 3; + } else { + /* Oh joy. gen4 doesn't have SIMD8 non-shadow-compare bias/lod + * instructions. We'll need to do SIMD16 here. + */ + assert(ir->op == ir_txb || ir->op == ir_txl); - coordinate = proj_coordinate; + for (int i = 0; i < ir->coordinate->type->vector_elements; i++) { + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen + i * 2), + coordinate)); + coordinate.reg_offset++; + } + + /* lod/bias appears after u/v/r. */ + mlen += 6; + + if (ir->op == ir_txb) { + ir->lod_info.bias->accept(this); + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), + this->result)); + mlen++; + } else { + ir->lod_info.lod->accept(this); + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), + this->result)); + mlen++; + } + + /* The unused upper half. */ + mlen++; + + /* Now, since we're doing simd16, the return is 2 interleaved + * vec4s where the odd-indexed ones are junk. We'll need to move + * this weirdness around to the expected layout. + */ + simd16 = true; + orig_dst = dst; + dst = fs_reg(this, glsl_type::get_array_instance(glsl_type::vec4_type, + 2)); + dst.type = BRW_REGISTER_TYPE_F; } - for (mlen = 0; mlen < ir->coordinate->type->vector_elements; mlen++) { - emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), coordinate)); - coordinate.reg_offset++; + fs_inst *inst = NULL; + switch (ir->op) { + case ir_tex: + inst = emit(fs_inst(FS_OPCODE_TEX, dst)); + break; + case ir_txb: + inst = emit(fs_inst(FS_OPCODE_TXB, dst)); + break; + case ir_txl: + inst = emit(fs_inst(FS_OPCODE_TXL, dst)); + break; + case ir_txd: + case ir_txf: + assert(!"GLSL 1.30 features unsupported"); + break; } + inst->base_mrf = base_mrf; + inst->mlen = mlen; - /* Pre-Ironlake, the 8-wide sampler always took u,v,r. */ - if (intel->gen < 5) - mlen = 3; + if (simd16) { + for (int i = 0; i < 4; i++) { + emit(fs_inst(BRW_OPCODE_MOV, orig_dst, dst)); + orig_dst.reg_offset++; + dst.reg_offset += 2; + } + } + + return inst; +} + +fs_inst * +fs_visitor::emit_texture_gen5(ir_texture *ir, fs_reg dst, fs_reg coordinate) +{ + /* gen5's SIMD8 sampler has slots for u, v, r, array index, then + * optional parameters like shadow comparitor or LOD bias. If + * optional parameters aren't present, those base slots are + * optional and don't need to be included in the message. + * + * We don't fill in the unnecessary slots regardless, which may + * look surprising in the disassembly. + */ + int mlen = 1; /* g0 header always present. */ + int base_mrf = 1; + + for (int i = 0; i < ir->coordinate->type->vector_elements; i++) { + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen + i), + coordinate)); + coordinate.reg_offset++; + } + mlen += ir->coordinate->type->vector_elements; if (ir->shadow_comparitor) { - /* For shadow comparisons, we have to supply u,v,r. */ - mlen = 3; + mlen = MAX2(mlen, 5); ir->shadow_comparitor->accept(this); emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), this->result)); mlen++; } - /* Do we ever want to handle writemasking on texture samples? Is it - * performance relevant? - */ - fs_reg dst = fs_reg(this, glsl_type::vec4_type); - + fs_inst *inst = NULL; switch (ir->op) { case ir_tex: - inst = emit(fs_inst(FS_OPCODE_TEX, dst, fs_reg(MRF, base_mrf))); + inst = emit(fs_inst(FS_OPCODE_TEX, dst)); break; case ir_txb: ir->lod_info.bias->accept(this); + mlen = MAX2(mlen, 5); emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), this->result)); mlen++; - inst = emit(fs_inst(FS_OPCODE_TXB, dst, fs_reg(MRF, base_mrf))); + inst = emit(fs_inst(FS_OPCODE_TXB, dst)); break; case ir_txl: ir->lod_info.lod->accept(this); + mlen = MAX2(mlen, 5); emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), this->result)); mlen++; - inst = emit(fs_inst(FS_OPCODE_TXL, dst, fs_reg(MRF, base_mrf))); + inst = emit(fs_inst(FS_OPCODE_TXL, dst)); break; case ir_txd: case ir_txf: assert(!"GLSL 1.30 features unsupported"); break; } + inst->base_mrf = base_mrf; + inst->mlen = mlen; + + return inst; +} + +void +fs_visitor::visit(ir_texture *ir) +{ + int sampler; + fs_inst *inst = NULL; + + ir->coordinate->accept(this); + fs_reg coordinate = this->result; + + /* Should be lowered by do_lower_texture_projection */ + assert(!ir->projector); + + sampler = _mesa_get_sampler_uniform_value(ir->sampler, + ctx->Shader.CurrentProgram, + &brw->fragment_program->Base); + sampler = c->fp->program.Base.SamplerUnits[sampler]; + + /* The 965 requires the EU to do the normalization of GL rectangle + * texture coordinates. We use the program parameter state + * tracking to get the scaling factor. + */ + if (ir->sampler->type->sampler_dimensionality == GLSL_SAMPLER_DIM_RECT) { + struct gl_program_parameter_list *params = c->fp->program.Base.Parameters; + int tokens[STATE_LENGTH] = { + STATE_INTERNAL, + STATE_TEXRECT_SCALE, + sampler, + 0, + 0 + }; + + fs_reg scale_x = fs_reg(UNIFORM, c->prog_data.nr_params); + fs_reg scale_y = fs_reg(UNIFORM, c->prog_data.nr_params + 1); + GLuint index = _mesa_add_state_reference(params, + (gl_state_index *)tokens); + float *vec_values = this->fp->Base.Parameters->ParameterValues[index]; + + c->prog_data.param[c->prog_data.nr_params++] = &vec_values[0]; + c->prog_data.param[c->prog_data.nr_params++] = &vec_values[1]; + + fs_reg dst = fs_reg(this, ir->coordinate->type); + fs_reg src = coordinate; + coordinate = dst; + + emit(fs_inst(BRW_OPCODE_MUL, dst, src, scale_x)); + dst.reg_offset++; + src.reg_offset++; + emit(fs_inst(BRW_OPCODE_MUL, dst, src, scale_y)); + } + + /* Writemasking doesn't eliminate channels on SIMD8 texture + * samples, so don't worry about them. + */ + fs_reg dst = fs_reg(this, glsl_type::vec4_type); + + if (intel->gen < 5) { + inst = emit_texture_gen4(ir, dst, coordinate); + } else { + inst = emit_texture_gen5(ir, dst, coordinate); + } + + inst->sampler = sampler; this->result = dst; if (ir->shadow_comparitor) inst->shadow_compare = true; - inst->mlen = mlen; + + if (c->key.tex_swizzles[inst->sampler] != SWIZZLE_NOOP) { + fs_reg swizzle_dst = fs_reg(this, glsl_type::vec4_type); + + for (int i = 0; i < 4; i++) { + int swiz = GET_SWZ(c->key.tex_swizzles[inst->sampler], i); + fs_reg l = swizzle_dst; + l.reg_offset += i; + + if (swiz == SWIZZLE_ZERO) { + emit(fs_inst(BRW_OPCODE_MOV, l, fs_reg(0.0f))); + } else if (swiz == SWIZZLE_ONE) { + emit(fs_inst(BRW_OPCODE_MOV, l, fs_reg(1.0f))); + } else { + fs_reg r = dst; + r.reg_offset += GET_SWZ(c->key.tex_swizzles[inst->sampler], i); + emit(fs_inst(BRW_OPCODE_MOV, l, r)); + } + } + this->result = swizzle_dst; + } } void @@ -959,6 +1273,11 @@ fs_visitor::visit(ir_swizzle *ir) ir->val->accept(this); fs_reg val = this->result; + if (ir->type->vector_elements == 1) { + this->result.reg_offset += ir->mask.x; + return; + } + fs_reg result = fs_reg(this, ir->type); this->result = result; @@ -990,9 +1309,13 @@ fs_visitor::visit(ir_swizzle *ir) void fs_visitor::visit(ir_discard *ir) { + fs_reg temp = fs_reg(this, glsl_type::uint_type); + assert(ir->condition == NULL); /* FINISHME */ - emit(fs_inst(FS_OPCODE_DISCARD)); + emit(fs_inst(FS_OPCODE_DISCARD_NOT, temp, reg_null_d)); + emit(fs_inst(FS_OPCODE_DISCARD_AND, reg_null_d, temp)); + kill_emitted = true; } void @@ -1023,6 +1346,108 @@ fs_visitor::visit(ir_constant *ir) } void +fs_visitor::emit_bool_to_cond_code(ir_rvalue *ir) +{ + ir_expression *expr = ir->as_expression(); + + if (expr) { + fs_reg op[2]; + fs_inst *inst; + + for (unsigned int i = 0; i < expr->get_num_operands(); i++) { + assert(expr->operands[i]->type->is_scalar()); + + expr->operands[i]->accept(this); + op[i] = this->result; + } + + switch (expr->operation) { + case ir_unop_logic_not: + inst = emit(fs_inst(BRW_OPCODE_AND, reg_null_d, op[0], fs_reg(1))); + inst->conditional_mod = BRW_CONDITIONAL_Z; + break; + + case ir_binop_logic_xor: + inst = emit(fs_inst(BRW_OPCODE_XOR, reg_null_d, op[0], op[1])); + inst->conditional_mod = BRW_CONDITIONAL_NZ; + break; + + case ir_binop_logic_or: + inst = emit(fs_inst(BRW_OPCODE_OR, reg_null_d, op[0], op[1])); + inst->conditional_mod = BRW_CONDITIONAL_NZ; + break; + + case ir_binop_logic_and: + inst = emit(fs_inst(BRW_OPCODE_AND, reg_null_d, op[0], op[1])); + inst->conditional_mod = BRW_CONDITIONAL_NZ; + break; + + case ir_unop_f2b: + if (intel->gen >= 6) { + inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_d, + op[0], fs_reg(0.0f))); + } else { + inst = emit(fs_inst(BRW_OPCODE_MOV, reg_null_d, op[0])); + } + inst->conditional_mod = BRW_CONDITIONAL_NZ; + break; + + case ir_unop_i2b: + if (intel->gen >= 6) { + inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_d, op[0], fs_reg(0))); + } else { + inst = emit(fs_inst(BRW_OPCODE_MOV, reg_null_d, op[0])); + } + inst->conditional_mod = BRW_CONDITIONAL_NZ; + break; + + case ir_binop_greater: + inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_d, op[0], op[1])); + inst->conditional_mod = BRW_CONDITIONAL_G; + break; + case ir_binop_gequal: + inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_d, op[0], op[1])); + inst->conditional_mod = BRW_CONDITIONAL_GE; + break; + case ir_binop_less: + inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_d, op[0], op[1])); + inst->conditional_mod = BRW_CONDITIONAL_L; + break; + case ir_binop_lequal: + inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_d, op[0], op[1])); + inst->conditional_mod = BRW_CONDITIONAL_LE; + break; + case ir_binop_equal: + case ir_binop_all_equal: + inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_d, op[0], op[1])); + inst->conditional_mod = BRW_CONDITIONAL_Z; + break; + case ir_binop_nequal: + case ir_binop_any_nequal: + inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_d, op[0], op[1])); + inst->conditional_mod = BRW_CONDITIONAL_NZ; + break; + default: + assert(!"not reached"); + this->fail = true; + break; + } + return; + } + + ir->accept(this); + + if (intel->gen >= 6) { + fs_inst *inst = emit(fs_inst(BRW_OPCODE_AND, reg_null_d, + this->result, fs_reg(1))); + inst->conditional_mod = BRW_CONDITIONAL_NZ; + } else { + fs_inst *inst = emit(fs_inst(BRW_OPCODE_MOV, reg_null_d, this->result)); + inst->conditional_mod = BRW_CONDITIONAL_NZ; + } +} + +void fs_visitor::visit(ir_if *ir) { fs_inst *inst; @@ -1032,10 +1457,7 @@ fs_visitor::visit(ir_if *ir) */ this->base_ir = ir->condition; - /* Generate the condition into the condition code. */ - ir->condition->accept(this); - inst = emit(fs_inst(BRW_OPCODE_MOV, fs_reg(brw_null_reg()), this->result)); - inst->conditional_mod = BRW_CONDITIONAL_NZ; + emit_bool_to_cond_code(ir->condition); inst = emit(fs_inst(BRW_OPCODE_IF)); inst->predicated = true; @@ -1064,32 +1486,69 @@ fs_visitor::visit(ir_if *ir) void fs_visitor::visit(ir_loop *ir) { - assert(!ir->from); - assert(!ir->to); - assert(!ir->increment); - assert(!ir->counter); + fs_reg counter = reg_undef; + + if (ir->counter) { + this->base_ir = ir->counter; + ir->counter->accept(this); + counter = *(variable_storage(ir->counter)); + + if (ir->from) { + this->base_ir = ir->from; + ir->from->accept(this); + + emit(fs_inst(BRW_OPCODE_MOV, counter, this->result)); + } + } emit(fs_inst(BRW_OPCODE_DO)); - /* Start a safety counter. If the user messed up their loop - * counting, we don't want to hang the GPU. - */ - fs_reg max_iter = fs_reg(this, glsl_type::int_type); - emit(fs_inst(BRW_OPCODE_MOV, max_iter, fs_reg(10000))); + if (ir->to) { + this->base_ir = ir->to; + ir->to->accept(this); + + fs_inst *inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_d, + counter, this->result)); + switch (ir->cmp) { + case ir_binop_equal: + inst->conditional_mod = BRW_CONDITIONAL_Z; + break; + case ir_binop_nequal: + inst->conditional_mod = BRW_CONDITIONAL_NZ; + break; + case ir_binop_gequal: + inst->conditional_mod = BRW_CONDITIONAL_GE; + break; + case ir_binop_lequal: + inst->conditional_mod = BRW_CONDITIONAL_LE; + break; + case ir_binop_greater: + inst->conditional_mod = BRW_CONDITIONAL_G; + break; + case ir_binop_less: + inst->conditional_mod = BRW_CONDITIONAL_L; + break; + default: + assert(!"not reached: unknown loop condition"); + this->fail = true; + break; + } + + inst = emit(fs_inst(BRW_OPCODE_BREAK)); + inst->predicated = true; + } foreach_iter(exec_list_iterator, iter, ir->body_instructions) { ir_instruction *ir = (ir_instruction *)iter.get(); - fs_inst *inst; this->base_ir = ir; ir->accept(this); + } - /* Check the maximum loop iters counter. */ - inst = emit(fs_inst(BRW_OPCODE_ADD, max_iter, max_iter, fs_reg(-1))); - inst->conditional_mod = BRW_CONDITIONAL_Z; - - inst = emit(fs_inst(BRW_OPCODE_BREAK)); - inst->predicated = true; + if (ir->increment) { + this->base_ir = ir->increment; + ir->increment->accept(this); + emit(fs_inst(BRW_OPCODE_ADD, counter, counter, this->result)); } emit(fs_inst(BRW_OPCODE_WHILE)); @@ -1186,6 +1645,7 @@ fs_visitor::emit_dummy_fs() write = emit(fs_inst(FS_OPCODE_FB_WRITE, fs_reg(0), fs_reg(0))); + write->base_mrf = 0; } /* The register location here is relative to the start of the URB @@ -1195,22 +1655,19 @@ fs_visitor::emit_dummy_fs() struct brw_reg fs_visitor::interp_reg(int location, int channel) { - int regnr = location * 2 + channel / 2; + int regnr = urb_setup[location] * 2 + channel / 2; int stride = (channel & 1) * 4; + assert(urb_setup[location] != -1); + return brw_vec1_grf(regnr, stride); } /** Emits the interpolation for the varying inputs. */ void -fs_visitor::emit_interpolation() +fs_visitor::emit_interpolation_setup_gen4() { struct brw_reg g1_uw = retype(brw_vec1_grf(1, 0), BRW_REGISTER_TYPE_UW); - /* For now, the source regs for the setup URB data will be unset, - * since we don't know until codegen how many push constants we'll - * use, and therefore what the setup URB offset is. - */ - fs_reg src_reg = reg_undef; this->current_annotation = "compute pixel centers"; this->pixel_x = fs_reg(this, glsl_type::uint_type); @@ -1227,8 +1684,14 @@ fs_visitor::emit_interpolation() fs_reg(brw_imm_v(0x11001100)))); this->current_annotation = "compute pixel deltas from v0"; - this->delta_x = fs_reg(this, glsl_type::float_type); - this->delta_y = fs_reg(this, glsl_type::float_type); + if (brw->has_pln) { + this->delta_x = fs_reg(this, glsl_type::vec2_type); + this->delta_y = this->delta_x; + this->delta_y.reg_offset++; + } else { + this->delta_x = fs_reg(this, glsl_type::float_type); + this->delta_y = fs_reg(this, glsl_type::float_type); + } emit(fs_inst(BRW_OPCODE_ADD, this->delta_x, this->pixel_x, @@ -1236,97 +1699,148 @@ fs_visitor::emit_interpolation() emit(fs_inst(BRW_OPCODE_ADD, this->delta_y, this->pixel_y, - fs_reg(brw_vec1_grf(1, 1)))); + fs_reg(negate(brw_vec1_grf(1, 1))))); this->current_annotation = "compute pos.w and 1/pos.w"; - /* Compute wpos. Unlike many other varying inputs, we usually need it - * to produce 1/w, and the varying variable wouldn't show up. + /* Compute wpos.w. It's always in our setup, since it's needed to + * interpolate the other attributes. */ - fs_reg wpos = fs_reg(this, glsl_type::vec4_type); - this->interp_attrs[FRAG_ATTRIB_WPOS] = wpos; - emit(fs_inst(BRW_OPCODE_MOV, wpos, this->pixel_x)); /* FINISHME: ARB_fcc */ - wpos.reg_offset++; - emit(fs_inst(BRW_OPCODE_MOV, wpos, this->pixel_y)); /* FINISHME: ARB_fcc */ - wpos.reg_offset++; - emit(fs_inst(FS_OPCODE_LINTERP, wpos, this->delta_x, this->delta_y, - interp_reg(FRAG_ATTRIB_WPOS, 2))); - wpos.reg_offset++; - emit(fs_inst(FS_OPCODE_LINTERP, wpos, this->delta_x, this->delta_y, + this->wpos_w = fs_reg(this, glsl_type::float_type); + emit(fs_inst(FS_OPCODE_LINTERP, wpos_w, this->delta_x, this->delta_y, interp_reg(FRAG_ATTRIB_WPOS, 3))); - /* Compute the pixel W value from wpos.w. */ + /* Compute the pixel 1/W value from wpos.w. */ this->pixel_w = fs_reg(this, glsl_type::float_type); - emit(fs_inst(FS_OPCODE_RCP, this->pixel_w, wpos)); + emit_math(FS_OPCODE_RCP, this->pixel_w, wpos_w); + this->current_annotation = NULL; +} - /* FINISHME: gl_FrontFacing */ +/** Emits the interpolation for the varying inputs. */ +void +fs_visitor::emit_interpolation_setup_gen6() +{ + struct brw_reg g1_uw = retype(brw_vec1_grf(1, 0), BRW_REGISTER_TYPE_UW); - foreach_iter(exec_list_iterator, iter, *this->shader->ir) { - ir_instruction *ir = (ir_instruction *)iter.get(); - ir_variable *var = ir->as_variable(); + /* If the pixel centers end up used, the setup is the same as for gen4. */ + this->current_annotation = "compute pixel centers"; + fs_reg int_pixel_x = fs_reg(this, glsl_type::uint_type); + fs_reg int_pixel_y = fs_reg(this, glsl_type::uint_type); + int_pixel_x.type = BRW_REGISTER_TYPE_UW; + int_pixel_y.type = BRW_REGISTER_TYPE_UW; + emit(fs_inst(BRW_OPCODE_ADD, + int_pixel_x, + fs_reg(stride(suboffset(g1_uw, 4), 2, 4, 0)), + fs_reg(brw_imm_v(0x10101010)))); + emit(fs_inst(BRW_OPCODE_ADD, + int_pixel_y, + fs_reg(stride(suboffset(g1_uw, 5), 2, 4, 0)), + fs_reg(brw_imm_v(0x11001100)))); - if (!var) - continue; + /* As of gen6, we can no longer mix float and int sources. We have + * to turn the integer pixel centers into floats for their actual + * use. + */ + this->pixel_x = fs_reg(this, glsl_type::float_type); + this->pixel_y = fs_reg(this, glsl_type::float_type); + emit(fs_inst(BRW_OPCODE_MOV, this->pixel_x, int_pixel_x)); + emit(fs_inst(BRW_OPCODE_MOV, this->pixel_y, int_pixel_y)); - if (var->mode != ir_var_in) - continue; + this->current_annotation = "compute 1/pos.w"; + this->wpos_w = fs_reg(brw_vec8_grf(c->key.source_w_reg, 0)); + this->pixel_w = fs_reg(this, glsl_type::float_type); + emit_math(FS_OPCODE_RCP, this->pixel_w, wpos_w); - /* If it's already set up (WPOS), skip. */ - if (var->location == 0) - continue; + this->delta_x = fs_reg(brw_vec8_grf(2, 0)); + this->delta_y = fs_reg(brw_vec8_grf(3, 0)); - this->current_annotation = talloc_asprintf(this->mem_ctx, - "interpolate %s " - "(FRAG_ATTRIB[%d])", - var->name, - var->location); - emit_pinterp(var->location); - } this->current_annotation = NULL; } void -fs_visitor::emit_pinterp(int location) +fs_visitor::emit_fb_writes() { - fs_reg interp_attr = fs_reg(this, glsl_type::vec4_type); - this->interp_attrs[location] = interp_attr; + this->current_annotation = "FB write header"; + GLboolean header_present = GL_TRUE; + int nr = 0; + + if (intel->gen >= 6 && + !this->kill_emitted && + c->key.nr_color_regions == 1) { + header_present = false; + } - for (unsigned int i = 0; i < 4; i++) { - struct brw_reg interp = interp_reg(location, i); - emit(fs_inst(FS_OPCODE_LINTERP, - interp_attr, - this->delta_x, - this->delta_y, - fs_reg(interp))); - interp_attr.reg_offset++; + if (header_present) { + /* m0, m1 header */ + nr += 2; } - interp_attr.reg_offset -= 4; - for (unsigned int i = 0; i < 4; i++) { - emit(fs_inst(BRW_OPCODE_MUL, - interp_attr, - interp_attr, - this->pixel_w)); - interp_attr.reg_offset++; + if (c->key.aa_dest_stencil_reg) { + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, nr++), + fs_reg(brw_vec8_grf(c->key.aa_dest_stencil_reg, 0)))); } -} -void -fs_visitor::emit_fb_writes() -{ - this->current_annotation = "FB write"; + /* Reserve space for color. It'll be filled in per MRT below. */ + int color_mrf = nr; + nr += 4; + + if (c->key.source_depth_to_render_target) { + if (c->key.computes_depth) { + /* Hand over gl_FragDepth. */ + assert(this->frag_depth); + fs_reg depth = *(variable_storage(this->frag_depth)); + + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, nr++), depth)); + } else { + /* Pass through the payload depth. */ + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, nr++), + fs_reg(brw_vec8_grf(c->key.source_depth_reg, 0)))); + } + } + + if (c->key.dest_depth_reg) { + emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, nr++), + fs_reg(brw_vec8_grf(c->key.dest_depth_reg, 0)))); + } + + fs_reg color = reg_undef; + if (this->frag_color) + color = *(variable_storage(this->frag_color)); + else if (this->frag_data) + color = *(variable_storage(this->frag_data)); - assert(this->frag_color || !"FINISHME: MRT"); - fs_reg color = *(variable_storage(this->frag_color)); + for (int target = 0; target < c->key.nr_color_regions; target++) { + this->current_annotation = talloc_asprintf(this->mem_ctx, + "FB write target %d", + target); + if (this->frag_color || this->frag_data) { + for (int i = 0; i < 4; i++) { + emit(fs_inst(BRW_OPCODE_MOV, + fs_reg(MRF, color_mrf + i), + color)); + color.reg_offset++; + } + } - for (int i = 0; i < 4; i++) { - emit(fs_inst(BRW_OPCODE_MOV, - fs_reg(MRF, 2 + i), - color)); - color.reg_offset++; + if (this->frag_color) + color.reg_offset -= 4; + + fs_inst *inst = emit(fs_inst(FS_OPCODE_FB_WRITE, + reg_undef, reg_undef)); + inst->target = target; + inst->base_mrf = 0; + inst->mlen = nr; + if (target == c->key.nr_color_regions - 1) + inst->eot = true; + inst->header_present = header_present; } - emit(fs_inst(FS_OPCODE_FB_WRITE, - fs_reg(0), - fs_reg(0))); + if (c->key.nr_color_regions == 0) { + fs_inst *inst = emit(fs_inst(FS_OPCODE_FB_WRITE, + reg_undef, reg_undef)); + inst->base_mrf = 0; + inst->mlen = nr; + inst->eot = true; + inst->header_present = header_present; + } this->current_annotation = NULL; } @@ -1334,8 +1848,8 @@ fs_visitor::emit_fb_writes() void fs_visitor::generate_fb_write(fs_inst *inst) { - GLboolean eot = 1; /* FINISHME: MRT */ - /* FINISHME: AADS */ + GLboolean eot = inst->eot; + struct brw_reg implied_header; /* Header is 2 regs, g0 and g1 are the contents. g0 will be implied * move, here's g1. @@ -1343,20 +1857,33 @@ fs_visitor::generate_fb_write(fs_inst *inst) brw_push_insn_state(p); brw_set_mask_control(p, BRW_MASK_DISABLE); brw_set_compression_control(p, BRW_COMPRESSION_NONE); - brw_MOV(p, - brw_message_reg(1), - brw_vec8_grf(1, 0)); - brw_pop_insn_state(p); - int nr = 2 + 4; + if (inst->header_present) { + if (intel->gen >= 6) { + brw_MOV(p, + brw_message_reg(inst->base_mrf), + brw_vec8_grf(0, 0)); + implied_header = brw_null_reg(); + } else { + implied_header = retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW); + } + + brw_MOV(p, + brw_message_reg(inst->base_mrf + 1), + brw_vec8_grf(1, 0)); + } else { + implied_header = brw_null_reg(); + } + + brw_pop_insn_state(p); brw_fb_WRITE(p, 8, /* dispatch_width */ retype(vec8(brw_null_reg()), BRW_REGISTER_TYPE_UW), - 0, /* base MRF */ - retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW), - 0, /* FINISHME: MRT target */ - nr, + inst->base_mrf, + implied_header, + inst->target, + inst->mlen, 0, eot); } @@ -1416,26 +1943,41 @@ fs_visitor::generate_math(fs_inst *inst, break; } - if (inst->opcode == FS_OPCODE_POW) { - brw_MOV(p, brw_message_reg(3), src[1]); + if (intel->gen >= 6) { + assert(inst->mlen == 0); + + if (inst->opcode == FS_OPCODE_POW) { + brw_math2(p, dst, op, src[0], src[1]); + } else { + brw_math(p, dst, + op, + inst->saturate ? BRW_MATH_SATURATE_SATURATE : + BRW_MATH_SATURATE_NONE, + 0, src[0], + BRW_MATH_DATA_VECTOR, + BRW_MATH_PRECISION_FULL); + } + } else { + assert(inst->mlen >= 1); + + brw_math(p, dst, + op, + inst->saturate ? BRW_MATH_SATURATE_SATURATE : + BRW_MATH_SATURATE_NONE, + inst->base_mrf, src[0], + BRW_MATH_DATA_VECTOR, + BRW_MATH_PRECISION_FULL); } - - brw_math(p, dst, - op, - inst->saturate ? BRW_MATH_SATURATE_SATURATE : - BRW_MATH_SATURATE_NONE, - 2, src[0], - BRW_MATH_DATA_VECTOR, - BRW_MATH_PRECISION_FULL); } void -fs_visitor::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src) +fs_visitor::generate_tex(fs_inst *inst, struct brw_reg dst) { int msg_type = -1; int rlen = 4; + uint32_t simd_mode = BRW_SAMPLER_SIMD_MODE_SIMD8; - if (intel->gen == 5) { + if (intel->gen >= 5) { switch (inst->opcode) { case FS_OPCODE_TEX: if (inst->shadow_compare) { @@ -1458,60 +2000,129 @@ fs_visitor::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src) /* Note that G45 and older determines shadow compare and dispatch width * from message length for most messages. */ + msg_type = BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE; if (inst->shadow_compare) { - msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE; + assert(inst->mlen == 6); } else { - msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE; + assert(inst->mlen <= 4); } + break; case FS_OPCODE_TXB: if (inst->shadow_compare) { - assert(!"FINISHME: shadow compare with bias."); - msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS; + assert(inst->mlen == 6); + msg_type = BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE; } else { + assert(inst->mlen == 9); msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS; - rlen = 8; + simd_mode = BRW_SAMPLER_SIMD_MODE_SIMD16; } break; } } assert(msg_type != -1); - /* g0 header. */ - src.nr--; + if (simd_mode == BRW_SAMPLER_SIMD_MODE_SIMD16) { + rlen = 8; + dst = vec16(dst); + } brw_SAMPLE(p, retype(dst, BRW_REGISTER_TYPE_UW), - src.nr, + inst->base_mrf, retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW), SURF_INDEX_TEXTURE(inst->sampler), inst->sampler, WRITEMASK_XYZW, msg_type, rlen, - inst->mlen + 1, + inst->mlen, 0, 1, - BRW_SAMPLER_SIMD_MODE_SIMD8); + simd_mode); } + +/* For OPCODE_DDX and OPCODE_DDY, per channel of output we've got input + * looking like: + * + * arg0: ss0.tl ss0.tr ss0.bl ss0.br ss1.tl ss1.tr ss1.bl ss1.br + * + * and we're trying to produce: + * + * DDX DDY + * dst: (ss0.tr - ss0.tl) (ss0.tl - ss0.bl) + * (ss0.tr - ss0.tl) (ss0.tr - ss0.br) + * (ss0.br - ss0.bl) (ss0.tl - ss0.bl) + * (ss0.br - ss0.bl) (ss0.tr - ss0.br) + * (ss1.tr - ss1.tl) (ss1.tl - ss1.bl) + * (ss1.tr - ss1.tl) (ss1.tr - ss1.br) + * (ss1.br - ss1.bl) (ss1.tl - ss1.bl) + * (ss1.br - ss1.bl) (ss1.tr - ss1.br) + * + * and add another set of two more subspans if in 16-pixel dispatch mode. + * + * For DDX, it ends up being easy: width = 2, horiz=0 gets us the same result + * for each pair, and vertstride = 2 jumps us 2 elements after processing a + * pair. But for DDY, it's harder, as we want to produce the pairs swizzled + * between each other. We could probably do it like ddx and swizzle the right + * order later, but bail for now and just produce + * ((ss0.tl - ss0.bl)x4 (ss1.tl - ss1.bl)x4) + */ void -fs_visitor::generate_discard(fs_inst *inst) +fs_visitor::generate_ddx(fs_inst *inst, struct brw_reg dst, struct brw_reg src) +{ + struct brw_reg src0 = brw_reg(src.file, src.nr, 1, + BRW_REGISTER_TYPE_F, + BRW_VERTICAL_STRIDE_2, + BRW_WIDTH_2, + BRW_HORIZONTAL_STRIDE_0, + BRW_SWIZZLE_XYZW, WRITEMASK_XYZW); + struct brw_reg src1 = brw_reg(src.file, src.nr, 0, + BRW_REGISTER_TYPE_F, + BRW_VERTICAL_STRIDE_2, + BRW_WIDTH_2, + BRW_HORIZONTAL_STRIDE_0, + BRW_SWIZZLE_XYZW, WRITEMASK_XYZW); + brw_ADD(p, dst, src0, negate(src1)); +} + +void +fs_visitor::generate_ddy(fs_inst *inst, struct brw_reg dst, struct brw_reg src) +{ + struct brw_reg src0 = brw_reg(src.file, src.nr, 0, + BRW_REGISTER_TYPE_F, + BRW_VERTICAL_STRIDE_4, + BRW_WIDTH_4, + BRW_HORIZONTAL_STRIDE_0, + BRW_SWIZZLE_XYZW, WRITEMASK_XYZW); + struct brw_reg src1 = brw_reg(src.file, src.nr, 2, + BRW_REGISTER_TYPE_F, + BRW_VERTICAL_STRIDE_4, + BRW_WIDTH_4, + BRW_HORIZONTAL_STRIDE_0, + BRW_SWIZZLE_XYZW, WRITEMASK_XYZW); + brw_ADD(p, dst, src0, negate(src1)); +} + +void +fs_visitor::generate_discard_not(fs_inst *inst, struct brw_reg mask) { - struct brw_reg g0 = retype(brw_vec1_grf(0, 0), BRW_REGISTER_TYPE_UW); brw_push_insn_state(p); brw_set_mask_control(p, BRW_MASK_DISABLE); - brw_NOT(p, c->emit_mask_reg, brw_mask_reg(1)); /* IMASK */ - brw_AND(p, g0, c->emit_mask_reg, g0); + brw_NOT(p, mask, brw_mask_reg(1)); /* IMASK */ brw_pop_insn_state(p); } -static void -trivial_assign_reg(int header_size, fs_reg *reg) +void +fs_visitor::generate_discard_and(fs_inst *inst, struct brw_reg mask) { - if (reg->file == GRF && reg->reg != 0) { - reg->hw_reg = header_size + reg->reg - 1 + reg->reg_offset; - reg->reg = 0; - } + struct brw_reg g0 = retype(brw_vec1_grf(0, 0), BRW_REGISTER_TYPE_UW); + mask = brw_uw1_reg(mask.file, mask.nr, 0); + + brw_push_insn_state(p); + brw_set_mask_control(p, BRW_MASK_DISABLE); + brw_AND(p, g0, mask, g0); + brw_pop_insn_state(p); } void @@ -1520,14 +2131,6 @@ fs_visitor::assign_curb_setup() c->prog_data.first_curbe_grf = c->key.nr_payload_regs; c->prog_data.curb_read_length = ALIGN(c->prog_data.nr_params, 8) / 8; - if (intel->gen == 5 && (c->prog_data.first_curbe_grf + - c->prog_data.curb_read_length) & 1) { - /* Align the start of the interpolation coefficients so that we can use - * the PLN instruction. - */ - c->prog_data.first_curbe_grf++; - } - /* Map the offsets in the UNIFORM file to fixed HW regs. */ foreach_iter(exec_list_iterator, iter, this->instructions) { fs_inst *inst = (fs_inst *)iter.get(); @@ -1547,28 +2150,50 @@ fs_visitor::assign_curb_setup() } void -fs_visitor::assign_urb_setup() +fs_visitor::calculate_urb_setup() { - int urb_start = c->prog_data.first_curbe_grf + c->prog_data.curb_read_length; - int interp_reg_nr[FRAG_ATTRIB_MAX]; - - c->prog_data.urb_read_length = 0; + for (unsigned int i = 0; i < FRAG_ATTRIB_MAX; i++) { + urb_setup[i] = -1; + } + int urb_next = 0; /* Figure out where each of the incoming setup attributes lands. */ - for (unsigned int i = 0; i < FRAG_ATTRIB_MAX; i++) { - interp_reg_nr[i] = -1; + if (intel->gen >= 6) { + for (unsigned int i = 0; i < FRAG_ATTRIB_MAX; i++) { + if (brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(i)) { + urb_setup[i] = urb_next++; + } + } + } else { + /* FINISHME: The sf doesn't map VS->FS inputs for us very well. */ + for (unsigned int i = 0; i < VERT_RESULT_MAX; i++) { + if (c->key.vp_outputs_written & BITFIELD64_BIT(i)) { + int fp_index; + + if (i >= VERT_RESULT_VAR0) + fp_index = i - (VERT_RESULT_VAR0 - FRAG_ATTRIB_VAR0); + else if (i <= VERT_RESULT_TEX7) + fp_index = i; + else + fp_index = -1; + + if (fp_index >= 0) + urb_setup[fp_index] = urb_next++; + } + } + } - if (i != FRAG_ATTRIB_WPOS && - !(brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(i))) - continue; + /* Each attribute is 4 setup channels, each of which is half a reg. */ + c->prog_data.urb_read_length = urb_next * 2; +} - /* Each attribute is 4 setup channels, each of which is half a reg. */ - interp_reg_nr[i] = urb_start + c->prog_data.urb_read_length; - c->prog_data.urb_read_length += 2; - } +void +fs_visitor::assign_urb_setup() +{ + int urb_start = c->prog_data.first_curbe_grf + c->prog_data.curb_read_length; - /* Map the register numbers for FS_OPCODE_LINTERP so that it uses - * the correct setup input. + /* Offset all the urb_setup[] index by the actual position of the + * setup regs, now that the location of the constants has been chosen. */ foreach_iter(exec_list_iterator, iter, this->instructions) { fs_inst *inst = (fs_inst *)iter.get(); @@ -1578,35 +2203,740 @@ fs_visitor::assign_urb_setup() assert(inst->src[2].file == FIXED_HW_REG); - int location = inst->src[2].fixed_hw_reg.nr / 2; - assert(interp_reg_nr[location] != -1); - inst->src[2].fixed_hw_reg.nr = (interp_reg_nr[location] + - (inst->src[2].fixed_hw_reg.nr & 1)); + inst->src[2].fixed_hw_reg.nr += urb_start; } this->first_non_payload_grf = urb_start + c->prog_data.urb_read_length; } +static void +assign_reg(int *reg_hw_locations, fs_reg *reg) +{ + if (reg->file == GRF && reg->reg != 0) { + assert(reg->reg_offset >= 0); + reg->hw_reg = reg_hw_locations[reg->reg] + reg->reg_offset; + reg->reg = 0; + } +} + void -fs_visitor::assign_regs() +fs_visitor::assign_regs_trivial() { - int header_size = this->first_non_payload_grf; int last_grf = 0; + int hw_reg_mapping[this->virtual_grf_next]; + int i; + + hw_reg_mapping[0] = 0; + hw_reg_mapping[1] = this->first_non_payload_grf; + for (i = 2; i < this->virtual_grf_next; i++) { + hw_reg_mapping[i] = (hw_reg_mapping[i - 1] + + this->virtual_grf_sizes[i - 1]); + } + last_grf = hw_reg_mapping[i - 1] + this->virtual_grf_sizes[i - 1]; - /* FINISHME: trivial assignment of register numbers */ foreach_iter(exec_list_iterator, iter, this->instructions) { fs_inst *inst = (fs_inst *)iter.get(); - trivial_assign_reg(header_size, &inst->dst); - trivial_assign_reg(header_size, &inst->src[0]); - trivial_assign_reg(header_size, &inst->src[1]); + assign_reg(hw_reg_mapping, &inst->dst); + assign_reg(hw_reg_mapping, &inst->src[0]); + assign_reg(hw_reg_mapping, &inst->src[1]); + } + + this->grf_used = last_grf + 1; +} + +void +fs_visitor::assign_regs() +{ + int last_grf = 0; + int hw_reg_mapping[this->virtual_grf_next + 1]; + int base_reg_count = BRW_MAX_GRF - this->first_non_payload_grf; + int class_sizes[base_reg_count]; + int class_count = 0; + int aligned_pair_class = -1; + + /* Set up the register classes. + * + * The base registers store a scalar value. For texture samples, + * we get virtual GRFs composed of 4 contiguous hw register. For + * structures and arrays, we store them as contiguous larger things + * than that, though we should be able to do better most of the + * time. + */ + class_sizes[class_count++] = 1; + if (brw->has_pln && intel->gen < 6) { + /* Always set up the (unaligned) pairs for gen5, so we can find + * them for making the aligned pair class. + */ + class_sizes[class_count++] = 2; + } + for (int r = 1; r < this->virtual_grf_next; r++) { + int i; + + for (i = 0; i < class_count; i++) { + if (class_sizes[i] == this->virtual_grf_sizes[r]) + break; + } + if (i == class_count) { + if (this->virtual_grf_sizes[r] >= base_reg_count) { + fprintf(stderr, "Object too large to register allocate.\n"); + this->fail = true; + } + + class_sizes[class_count++] = this->virtual_grf_sizes[r]; + } + } + + int ra_reg_count = 0; + int class_base_reg[class_count]; + int class_reg_count[class_count]; + int classes[class_count + 1]; + + for (int i = 0; i < class_count; i++) { + class_base_reg[i] = ra_reg_count; + class_reg_count[i] = base_reg_count - (class_sizes[i] - 1); + ra_reg_count += class_reg_count[i]; + } + + struct ra_regs *regs = ra_alloc_reg_set(ra_reg_count); + for (int i = 0; i < class_count; i++) { + classes[i] = ra_alloc_reg_class(regs); + + for (int i_r = 0; i_r < class_reg_count[i]; i_r++) { + ra_class_add_reg(regs, classes[i], class_base_reg[i] + i_r); + } + + /* Add conflicts between our contiguous registers aliasing + * base regs and other register classes' contiguous registers + * that alias base regs, or the base regs themselves for classes[0]. + */ + for (int c = 0; c <= i; c++) { + for (int i_r = 0; i_r < class_reg_count[i]; i_r++) { + for (int c_r = MAX2(0, i_r - (class_sizes[c] - 1)); + c_r < MIN2(class_reg_count[c], i_r + class_sizes[i]); + c_r++) { + + if (0) { + printf("%d/%d conflicts %d/%d\n", + class_sizes[i], this->first_non_payload_grf + i_r, + class_sizes[c], this->first_non_payload_grf + c_r); + } + + ra_add_reg_conflict(regs, + class_base_reg[i] + i_r, + class_base_reg[c] + c_r); + } + } + } + } + + /* Add a special class for aligned pairs, which we'll put delta_x/y + * in on gen5 so that we can do PLN. + */ + if (brw->has_pln && intel->gen < 6) { + int reg_count = (base_reg_count - 1) / 2; + int unaligned_pair_class = 1; + assert(class_sizes[unaligned_pair_class] == 2); + + aligned_pair_class = class_count; + classes[aligned_pair_class] = ra_alloc_reg_class(regs); + class_sizes[aligned_pair_class] = 2; + class_base_reg[aligned_pair_class] = 0; + class_reg_count[aligned_pair_class] = 0; + int start = (this->first_non_payload_grf & 1) ? 1 : 0; + + for (int i = 0; i < reg_count; i++) { + ra_class_add_reg(regs, classes[aligned_pair_class], + class_base_reg[unaligned_pair_class] + i * 2 + start); + } + class_count++; + } + + ra_set_finalize(regs); + + struct ra_graph *g = ra_alloc_interference_graph(regs, + this->virtual_grf_next); + /* Node 0 is just a placeholder to keep virtual_grf[] mapping 1:1 + * with nodes. + */ + ra_set_node_class(g, 0, classes[0]); + + for (int i = 1; i < this->virtual_grf_next; i++) { + for (int c = 0; c < class_count; c++) { + if (class_sizes[c] == this->virtual_grf_sizes[i]) { + if (aligned_pair_class >= 0 && + this->delta_x.reg == i) { + ra_set_node_class(g, i, classes[aligned_pair_class]); + } else { + ra_set_node_class(g, i, classes[c]); + } + break; + } + } + + for (int j = 1; j < i; j++) { + if (virtual_grf_interferes(i, j)) { + ra_add_node_interference(g, i, j); + } + } + } + + /* FINISHME: Handle spilling */ + if (!ra_allocate_no_spills(g)) { + fprintf(stderr, "Failed to allocate registers.\n"); + this->fail = true; + return; + } + + /* Get the chosen virtual registers for each node, and map virtual + * regs in the register classes back down to real hardware reg + * numbers. + */ + hw_reg_mapping[0] = 0; /* unused */ + for (int i = 1; i < this->virtual_grf_next; i++) { + int reg = ra_get_node_reg(g, i); + int hw_reg = -1; + + for (int c = 0; c < class_count; c++) { + if (reg >= class_base_reg[c] && + reg < class_base_reg[c] + class_reg_count[c]) { + hw_reg = reg - class_base_reg[c]; + break; + } + } + + assert(hw_reg >= 0); + hw_reg_mapping[i] = this->first_non_payload_grf + hw_reg; + last_grf = MAX2(last_grf, + hw_reg_mapping[i] + this->virtual_grf_sizes[i] - 1); + } + + foreach_iter(exec_list_iterator, iter, this->instructions) { + fs_inst *inst = (fs_inst *)iter.get(); - last_grf = MAX2(last_grf, inst->dst.hw_reg); - last_grf = MAX2(last_grf, inst->src[0].hw_reg); - last_grf = MAX2(last_grf, inst->src[1].hw_reg); + assign_reg(hw_reg_mapping, &inst->dst); + assign_reg(hw_reg_mapping, &inst->src[0]); + assign_reg(hw_reg_mapping, &inst->src[1]); } this->grf_used = last_grf + 1; + + talloc_free(g); + talloc_free(regs); +} + +/** + * Split large virtual GRFs into separate components if we can. + * + * This is mostly duplicated with what brw_fs_vector_splitting does, + * but that's really conservative because it's afraid of doing + * splitting that doesn't result in real progress after the rest of + * the optimization phases, which would cause infinite looping in + * optimization. We can do it once here, safely. This also has the + * opportunity to split interpolated values, or maybe even uniforms, + * which we don't have at the IR level. + * + * We want to split, because virtual GRFs are what we register + * allocate and spill (due to contiguousness requirements for some + * instructions), and they're what we naturally generate in the + * codegen process, but most virtual GRFs don't actually need to be + * contiguous sets of GRFs. If we split, we'll end up with reduced + * live intervals and better dead code elimination and coalescing. + */ +void +fs_visitor::split_virtual_grfs() +{ + int num_vars = this->virtual_grf_next; + bool split_grf[num_vars]; + int new_virtual_grf[num_vars]; + + /* Try to split anything > 0 sized. */ + for (int i = 0; i < num_vars; i++) { + if (this->virtual_grf_sizes[i] != 1) + split_grf[i] = true; + else + split_grf[i] = false; + } + + if (brw->has_pln) { + /* PLN opcodes rely on the delta_xy being contiguous. */ + split_grf[this->delta_x.reg] = false; + } + + foreach_iter(exec_list_iterator, iter, this->instructions) { + fs_inst *inst = (fs_inst *)iter.get(); + + /* Texturing produces 4 contiguous registers, so no splitting. */ + if ((inst->opcode == FS_OPCODE_TEX || + inst->opcode == FS_OPCODE_TXB || + inst->opcode == FS_OPCODE_TXL) && + inst->dst.file == GRF) { + split_grf[inst->dst.reg] = false; + } + } + + /* Allocate new space for split regs. Note that the virtual + * numbers will be contiguous. + */ + for (int i = 0; i < num_vars; i++) { + if (split_grf[i]) { + new_virtual_grf[i] = virtual_grf_alloc(1); + for (int j = 2; j < this->virtual_grf_sizes[i]; j++) { + int reg = virtual_grf_alloc(1); + assert(reg == new_virtual_grf[i] + j - 1); + } + this->virtual_grf_sizes[i] = 1; + } + } + + foreach_iter(exec_list_iterator, iter, this->instructions) { + fs_inst *inst = (fs_inst *)iter.get(); + + if (inst->dst.file == GRF && + split_grf[inst->dst.reg] && + inst->dst.reg_offset != 0) { + inst->dst.reg = (new_virtual_grf[inst->dst.reg] + + inst->dst.reg_offset - 1); + inst->dst.reg_offset = 0; + } + for (int i = 0; i < 3; i++) { + if (inst->src[i].file == GRF && + split_grf[inst->src[i].reg] && + inst->src[i].reg_offset != 0) { + inst->src[i].reg = (new_virtual_grf[inst->src[i].reg] + + inst->src[i].reg_offset - 1); + inst->src[i].reg_offset = 0; + } + } + } +} + +void +fs_visitor::calculate_live_intervals() +{ + int num_vars = this->virtual_grf_next; + int *def = talloc_array(mem_ctx, int, num_vars); + int *use = talloc_array(mem_ctx, int, num_vars); + int loop_depth = 0; + int loop_start = 0; + + for (int i = 0; i < num_vars; i++) { + def[i] = 1 << 30; + use[i] = -1; + } + + int ip = 0; + foreach_iter(exec_list_iterator, iter, this->instructions) { + fs_inst *inst = (fs_inst *)iter.get(); + + if (inst->opcode == BRW_OPCODE_DO) { + if (loop_depth++ == 0) + loop_start = ip; + } else if (inst->opcode == BRW_OPCODE_WHILE) { + loop_depth--; + + if (loop_depth == 0) { + /* FINISHME: + * + * Patches up any vars marked for use within the loop as + * live until the end. This is conservative, as there + * will often be variables defined and used inside the + * loop but dead at the end of the loop body. + */ + for (int i = 0; i < num_vars; i++) { + if (use[i] == loop_start) { + use[i] = ip; + } + } + } + } else { + int eip = ip; + + if (loop_depth) + eip = loop_start; + + for (unsigned int i = 0; i < 3; i++) { + if (inst->src[i].file == GRF && inst->src[i].reg != 0) { + use[inst->src[i].reg] = MAX2(use[inst->src[i].reg], eip); + } + } + if (inst->dst.file == GRF && inst->dst.reg != 0) { + def[inst->dst.reg] = MIN2(def[inst->dst.reg], eip); + } + } + + ip++; + } + + talloc_free(this->virtual_grf_def); + talloc_free(this->virtual_grf_use); + this->virtual_grf_def = def; + this->virtual_grf_use = use; +} + +/** + * Attempts to move immediate constants into the immediate + * constant slot of following instructions. + * + * Immediate constants are a bit tricky -- they have to be in the last + * operand slot, you can't do abs/negate on them, + */ + +bool +fs_visitor::propagate_constants() +{ + bool progress = false; + + foreach_iter(exec_list_iterator, iter, this->instructions) { + fs_inst *inst = (fs_inst *)iter.get(); + + if (inst->opcode != BRW_OPCODE_MOV || + inst->predicated || + inst->dst.file != GRF || inst->src[0].file != IMM || + inst->dst.type != inst->src[0].type) + continue; + + /* Don't bother with cases where we should have had the + * operation on the constant folded in GLSL already. + */ + if (inst->saturate) + continue; + + /* Found a move of a constant to a GRF. Find anything else using the GRF + * before it's written, and replace it with the constant if we can. + */ + exec_list_iterator scan_iter = iter; + scan_iter.next(); + for (; scan_iter.has_next(); scan_iter.next()) { + fs_inst *scan_inst = (fs_inst *)scan_iter.get(); + + if (scan_inst->opcode == BRW_OPCODE_DO || + scan_inst->opcode == BRW_OPCODE_WHILE || + scan_inst->opcode == BRW_OPCODE_ELSE || + scan_inst->opcode == BRW_OPCODE_ENDIF) { + break; + } + + for (int i = 2; i >= 0; i--) { + if (scan_inst->src[i].file != GRF || + scan_inst->src[i].reg != inst->dst.reg || + scan_inst->src[i].reg_offset != inst->dst.reg_offset) + continue; + + /* Don't bother with cases where we should have had the + * operation on the constant folded in GLSL already. + */ + if (scan_inst->src[i].negate || scan_inst->src[i].abs) + continue; + + switch (scan_inst->opcode) { + case BRW_OPCODE_MOV: + scan_inst->src[i] = inst->src[0]; + progress = true; + break; + + case BRW_OPCODE_MUL: + case BRW_OPCODE_ADD: + if (i == 1) { + scan_inst->src[i] = inst->src[0]; + progress = true; + } else if (i == 0 && scan_inst->src[1].file != IMM) { + /* Fit this constant in by commuting the operands */ + scan_inst->src[0] = scan_inst->src[1]; + scan_inst->src[1] = inst->src[0]; + } + break; + case BRW_OPCODE_CMP: + if (i == 1) { + scan_inst->src[i] = inst->src[0]; + progress = true; + } + } + } + + if (scan_inst->dst.file == GRF && + scan_inst->dst.reg == inst->dst.reg && + (scan_inst->dst.reg_offset == inst->dst.reg_offset || + scan_inst->opcode == FS_OPCODE_TEX)) { + break; + } + } + } + + return progress; +} +/** + * Must be called after calculate_live_intervales() to remove unused + * writes to registers -- register allocation will fail otherwise + * because something deffed but not used won't be considered to + * interfere with other regs. + */ +bool +fs_visitor::dead_code_eliminate() +{ + bool progress = false; + int num_vars = this->virtual_grf_next; + bool dead[num_vars]; + + for (int i = 0; i < num_vars; i++) { + dead[i] = this->virtual_grf_def[i] >= this->virtual_grf_use[i]; + + if (dead[i]) { + /* Mark off its interval so it won't interfere with anything. */ + this->virtual_grf_def[i] = -1; + this->virtual_grf_use[i] = -1; + } + } + + foreach_iter(exec_list_iterator, iter, this->instructions) { + fs_inst *inst = (fs_inst *)iter.get(); + + if (inst->dst.file == GRF && dead[inst->dst.reg]) { + inst->remove(); + progress = true; + } + } + + return progress; +} + +bool +fs_visitor::register_coalesce() +{ + bool progress = false; + + foreach_iter(exec_list_iterator, iter, this->instructions) { + fs_inst *inst = (fs_inst *)iter.get(); + + if (inst->opcode != BRW_OPCODE_MOV || + inst->predicated || + inst->saturate || + inst->dst.file != GRF || inst->src[0].file != GRF || + inst->dst.type != inst->src[0].type) + continue; + + /* Found a move of a GRF to a GRF. Let's see if we can coalesce + * them: check for no writes to either one until the exit of the + * program. + */ + bool interfered = false; + exec_list_iterator scan_iter = iter; + scan_iter.next(); + for (; scan_iter.has_next(); scan_iter.next()) { + fs_inst *scan_inst = (fs_inst *)scan_iter.get(); + + if (scan_inst->opcode == BRW_OPCODE_DO || + scan_inst->opcode == BRW_OPCODE_WHILE || + scan_inst->opcode == BRW_OPCODE_ENDIF) { + interfered = true; + iter = scan_iter; + break; + } + + if (scan_inst->dst.file == GRF) { + if (scan_inst->dst.reg == inst->dst.reg && + (scan_inst->dst.reg_offset == inst->dst.reg_offset || + scan_inst->opcode == FS_OPCODE_TEX)) { + interfered = true; + break; + } + if (scan_inst->dst.reg == inst->src[0].reg && + (scan_inst->dst.reg_offset == inst->src[0].reg_offset || + scan_inst->opcode == FS_OPCODE_TEX)) { + interfered = true; + break; + } + } + } + if (interfered) { + continue; + } + + /* Update live interval so we don't have to recalculate. */ + this->virtual_grf_use[inst->src[0].reg] = MAX2(virtual_grf_use[inst->src[0].reg], + virtual_grf_use[inst->dst.reg]); + + /* Rewrite the later usage to point at the source of the move to + * be removed. + */ + for (exec_list_iterator scan_iter = iter; scan_iter.has_next(); + scan_iter.next()) { + fs_inst *scan_inst = (fs_inst *)scan_iter.get(); + + for (int i = 0; i < 3; i++) { + if (scan_inst->src[i].file == GRF && + scan_inst->src[i].reg == inst->dst.reg && + scan_inst->src[i].reg_offset == inst->dst.reg_offset) { + scan_inst->src[i].reg = inst->src[0].reg; + scan_inst->src[i].reg_offset = inst->src[0].reg_offset; + scan_inst->src[i].abs |= inst->src[0].abs; + scan_inst->src[i].negate ^= inst->src[0].negate; + } + } + } + + inst->remove(); + progress = true; + } + + return progress; +} + + +bool +fs_visitor::compute_to_mrf() +{ + bool progress = false; + int next_ip = 0; + + foreach_iter(exec_list_iterator, iter, this->instructions) { + fs_inst *inst = (fs_inst *)iter.get(); + + int ip = next_ip; + next_ip++; + + if (inst->opcode != BRW_OPCODE_MOV || + inst->predicated || + inst->dst.file != MRF || inst->src[0].file != GRF || + inst->dst.type != inst->src[0].type || + inst->src[0].abs || inst->src[0].negate) + continue; + + /* Can't compute-to-MRF this GRF if someone else was going to + * read it later. + */ + if (this->virtual_grf_use[inst->src[0].reg] > ip) + continue; + + /* Found a move of a GRF to a MRF. Let's see if we can go + * rewrite the thing that made this GRF to write into the MRF. + */ + bool found = false; + fs_inst *scan_inst; + for (scan_inst = (fs_inst *)inst->prev; + scan_inst->prev != NULL; + scan_inst = (fs_inst *)scan_inst->prev) { + /* We don't handle flow control here. Most computation of + * values that end up in MRFs are shortly before the MRF + * write anyway. + */ + if (scan_inst->opcode == BRW_OPCODE_DO || + scan_inst->opcode == BRW_OPCODE_WHILE || + scan_inst->opcode == BRW_OPCODE_ENDIF) { + break; + } + + /* You can't read from an MRF, so if someone else reads our + * MRF's source GRF that we wanted to rewrite, that stops us. + */ + bool interfered = false; + for (int i = 0; i < 3; i++) { + if (scan_inst->src[i].file == GRF && + scan_inst->src[i].reg == inst->src[0].reg && + scan_inst->src[i].reg_offset == inst->src[0].reg_offset) { + interfered = true; + } + } + if (interfered) + break; + + if (scan_inst->dst.file == MRF && + scan_inst->dst.hw_reg == inst->dst.hw_reg) { + /* Somebody else wrote our MRF here, so we can't can't + * compute-to-MRF before that. + */ + break; + } + + if (scan_inst->mlen > 0) { + /* Found a SEND instruction, which will do some amount of + * implied write that may overwrite our MRF that we were + * hoping to compute-to-MRF somewhere above it. Nothing + * we have implied-writes more than 2 MRFs from base_mrf, + * though. + */ + int implied_write_len = MIN2(scan_inst->mlen, 2); + if (inst->dst.hw_reg >= scan_inst->base_mrf && + inst->dst.hw_reg < scan_inst->base_mrf + implied_write_len) { + break; + } + } + + if (scan_inst->dst.file == GRF && + scan_inst->dst.reg == inst->src[0].reg) { + /* Found the last thing to write our reg we want to turn + * into a compute-to-MRF. + */ + + if (scan_inst->opcode == FS_OPCODE_TEX) { + /* texturing writes several continuous regs, so we can't + * compute-to-mrf that. + */ + break; + } + + /* If it's predicated, it (probably) didn't populate all + * the channels. + */ + if (scan_inst->predicated) + break; + + /* SEND instructions can't have MRF as a destination. */ + if (scan_inst->mlen) + break; + + if (intel->gen >= 6) { + /* gen6 math instructions must have the destination be + * GRF, so no compute-to-MRF for them. + */ + if (scan_inst->opcode == FS_OPCODE_RCP || + scan_inst->opcode == FS_OPCODE_RSQ || + scan_inst->opcode == FS_OPCODE_SQRT || + scan_inst->opcode == FS_OPCODE_EXP2 || + scan_inst->opcode == FS_OPCODE_LOG2 || + scan_inst->opcode == FS_OPCODE_SIN || + scan_inst->opcode == FS_OPCODE_COS || + scan_inst->opcode == FS_OPCODE_POW) { + break; + } + } + + if (scan_inst->dst.reg_offset == inst->src[0].reg_offset) { + /* Found the creator of our MRF's source value. */ + found = true; + break; + } + } + } + if (found) { + scan_inst->dst.file = MRF; + scan_inst->dst.hw_reg = inst->dst.hw_reg; + scan_inst->saturate |= inst->saturate; + inst->remove(); + progress = true; + } + } + + return progress; +} + +bool +fs_visitor::virtual_grf_interferes(int a, int b) +{ + int start = MAX2(this->virtual_grf_def[a], this->virtual_grf_def[b]); + int end = MIN2(this->virtual_grf_use[a], this->virtual_grf_use[b]); + + /* For dead code, just check if the def interferes with the other range. */ + if (this->virtual_grf_use[a] == -1) { + return (this->virtual_grf_def[a] >= this->virtual_grf_def[b] && + this->virtual_grf_def[a] < this->virtual_grf_use[b]); + } + if (this->virtual_grf_use[b] == -1) { + return (this->virtual_grf_def[b] >= this->virtual_grf_def[a] && + this->virtual_grf_def[b] < this->virtual_grf_use[a]); + } + + return start < end; } static struct brw_reg brw_reg_from_fs_reg(fs_reg *reg) @@ -1698,6 +3028,9 @@ fs_visitor::generate_code() case BRW_OPCODE_RNDD: brw_RNDD(p, dst, src[0]); break; + case BRW_OPCODE_RNDE: + brw_RNDE(p, dst, src[0]); + break; case BRW_OPCODE_RNDZ: brw_RNDZ(p, dst, src[0]); break; @@ -1711,6 +3044,18 @@ fs_visitor::generate_code() case BRW_OPCODE_XOR: brw_XOR(p, dst, src[0], src[1]); break; + case BRW_OPCODE_NOT: + brw_NOT(p, dst, src[0]); + break; + case BRW_OPCODE_ASR: + brw_ASR(p, dst, src[0], src[1]); + break; + case BRW_OPCODE_SHR: + brw_SHR(p, dst, src[0], src[1]); + break; + case BRW_OPCODE_SHL: + brw_SHL(p, dst, src[0], src[1]); + break; case BRW_OPCODE_CMP: brw_CMP(p, dst, inst->conditional_mod, src[0], src[1]); @@ -1722,6 +3067,7 @@ fs_visitor::generate_code() case BRW_OPCODE_IF: assert(if_stack_depth < 16); if_stack[if_stack_depth] = brw_IF(p, BRW_EXECUTE_8); + if_depth_in_loop[loop_stack_depth]++; if_stack_depth++; break; case BRW_OPCODE_ELSE: @@ -1731,6 +3077,7 @@ fs_visitor::generate_code() case BRW_OPCODE_ENDIF: if_stack_depth--; brw_ENDIF(p , if_stack[if_stack_depth]); + if_depth_in_loop[loop_stack_depth]--; break; case BRW_OPCODE_DO: @@ -1751,7 +3098,7 @@ fs_visitor::generate_code() struct brw_instruction *inst0, *inst1; GLuint br = 1; - if (intel->gen == 5) + if (intel->gen >= 5) br = 2; assert(loop_stack_depth > 0); @@ -1788,10 +3135,19 @@ fs_visitor::generate_code() case FS_OPCODE_TEX: case FS_OPCODE_TXB: case FS_OPCODE_TXL: - generate_tex(inst, dst, src[0]); + generate_tex(inst, dst); break; - case FS_OPCODE_DISCARD: - generate_discard(inst); + case FS_OPCODE_DISCARD_NOT: + generate_discard_not(inst, dst); + break; + case FS_OPCODE_DISCARD_AND: + generate_discard_and(inst, src[0]); + break; + case FS_OPCODE_DDX: + generate_ddx(inst, dst, src[0]); + break; + case FS_OPCODE_DDY: + generate_ddy(inst, dst, src[0]); break; case FS_OPCODE_FB_WRITE: generate_fb_write(inst); @@ -1834,22 +3190,14 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) { struct brw_compile *p = &c->func; struct intel_context *intel = &brw->intel; - GLcontext *ctx = &intel->ctx; - struct brw_shader *shader = NULL; + struct gl_context *ctx = &intel->ctx; struct gl_shader_program *prog = ctx->Shader.CurrentProgram; if (!prog) return GL_FALSE; - if (!using_new_fs) - return GL_FALSE; - - for (unsigned int i = 0; i < prog->_NumLinkedShaders; i++) { - if (prog->_LinkedShaders[i]->Type == GL_FRAGMENT_SHADER) { - shader = (struct brw_shader *)prog->_LinkedShaders[i]; - break; - } - } + struct brw_shader *shader = + (brw_shader *) prog->_LinkedShaders[MESA_SHADER_FRAGMENT]; if (!shader) return GL_FALSE; @@ -1874,7 +3222,11 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) if (0) { v.emit_dummy_fs(); } else { - v.emit_interpolation(); + v.calculate_urb_setup(); + if (intel->gen < 6) + v.emit_interpolation_setup_gen4(); + else + v.emit_interpolation_setup_gen6(); /* Generate FS IR for main(). (the visitor only descends into * functions called "main"). @@ -1886,12 +3238,30 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) } v.emit_fb_writes(); + + v.split_virtual_grfs(); + v.assign_curb_setup(); v.assign_urb_setup(); - v.assign_regs(); + + bool progress; + do { + progress = false; + v.calculate_live_intervals(); + progress = v.propagate_constants() || progress; + progress = v.register_coalesce() || progress; + progress = v.compute_to_mrf() || progress; + progress = v.dead_code_eliminate() || progress; + } while (progress); + + if (0) + v.assign_regs_trivial(); + else + v.assign_regs(); } - v.generate_code(); + if (!v.fail) + v.generate_code(); assert(!v.fail); /* FINISHME: Cleanly fail, tested at link time, etc. */ @@ -1918,6 +3288,11 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) printf(" %s\n", last_annotation_string); } brw_disasm(stdout, &p->store[i], intel->gen); + printf("0x%08x 0x%08x 0x%08x 0x%08x\n", + ((uint32_t *)&p->store[i])[3], + ((uint32_t *)&p->store[i])[2], + ((uint32_t *)&p->store[i])[1], + ((uint32_t *)&p->store[i])[0]); } printf("\n"); } diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h new file mode 100644 index 0000000000..b7f4e15c76 --- /dev/null +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -0,0 +1,447 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Eric Anholt <eric@anholt.net> + * + */ + +extern "C" { + +#include <sys/types.h> + +#include "main/macros.h" +#include "main/shaderobj.h" +#include "main/uniforms.h" +#include "program/prog_parameter.h" +#include "program/prog_print.h" +#include "program/prog_optimize.h" +#include "program/register_allocate.h" +#include "program/sampler.h" +#include "program/hash_table.h" +#include "brw_context.h" +#include "brw_eu.h" +#include "brw_wm.h" +#include "talloc.h" +} +#include "../glsl/glsl_types.h" +#include "../glsl/ir.h" + +enum register_file { + ARF = BRW_ARCHITECTURE_REGISTER_FILE, + GRF = BRW_GENERAL_REGISTER_FILE, + MRF = BRW_MESSAGE_REGISTER_FILE, + IMM = BRW_IMMEDIATE_VALUE, + FIXED_HW_REG, /* a struct brw_reg */ + UNIFORM, /* prog_data->params[hw_reg] */ + BAD_FILE +}; + +enum fs_opcodes { + FS_OPCODE_FB_WRITE = 256, + FS_OPCODE_RCP, + FS_OPCODE_RSQ, + FS_OPCODE_SQRT, + FS_OPCODE_EXP2, + FS_OPCODE_LOG2, + FS_OPCODE_POW, + FS_OPCODE_SIN, + FS_OPCODE_COS, + FS_OPCODE_DDX, + FS_OPCODE_DDY, + FS_OPCODE_LINTERP, + FS_OPCODE_TEX, + FS_OPCODE_TXB, + FS_OPCODE_TXL, + FS_OPCODE_DISCARD_NOT, + FS_OPCODE_DISCARD_AND, +}; + + +class fs_reg { +public: + /* Callers of this talloc-based new need not call delete. It's + * easier to just talloc_free 'ctx' (or any of its ancestors). */ + static void* operator new(size_t size, void *ctx) + { + void *node; + + node = talloc_size(ctx, size); + assert(node != NULL); + + return node; + } + + void init() + { + this->reg = 0; + this->reg_offset = 0; + this->negate = 0; + this->abs = 0; + this->hw_reg = -1; + } + + /** Generic unset register constructor. */ + fs_reg() + { + init(); + this->file = BAD_FILE; + } + + /** Immediate value constructor. */ + fs_reg(float f) + { + init(); + this->file = IMM; + this->type = BRW_REGISTER_TYPE_F; + this->imm.f = f; + } + + /** Immediate value constructor. */ + fs_reg(int32_t i) + { + init(); + this->file = IMM; + this->type = BRW_REGISTER_TYPE_D; + this->imm.i = i; + } + + /** Immediate value constructor. */ + fs_reg(uint32_t u) + { + init(); + this->file = IMM; + this->type = BRW_REGISTER_TYPE_UD; + this->imm.u = u; + } + + /** Fixed brw_reg Immediate value constructor. */ + fs_reg(struct brw_reg fixed_hw_reg) + { + init(); + this->file = FIXED_HW_REG; + this->fixed_hw_reg = fixed_hw_reg; + this->type = fixed_hw_reg.type; + } + + fs_reg(enum register_file file, int hw_reg); + fs_reg(enum register_file file, int hw_reg, uint32_t type); + fs_reg(class fs_visitor *v, const struct glsl_type *type); + + /** Register file: ARF, GRF, MRF, IMM. */ + enum register_file file; + /** virtual register number. 0 = fixed hw reg */ + int reg; + /** Offset within the virtual register. */ + int reg_offset; + /** HW register number. Generally unset until register allocation. */ + int hw_reg; + /** Register type. BRW_REGISTER_TYPE_* */ + int type; + bool negate; + bool abs; + struct brw_reg fixed_hw_reg; + + /** Value for file == BRW_IMMMEDIATE_FILE */ + union { + int32_t i; + uint32_t u; + float f; + } imm; +}; + +class fs_inst : public exec_node { +public: + /* Callers of this talloc-based new need not call delete. It's + * easier to just talloc_free 'ctx' (or any of its ancestors). */ + static void* operator new(size_t size, void *ctx) + { + void *node; + + node = talloc_zero_size(ctx, size); + assert(node != NULL); + + return node; + } + + void init() + { + this->opcode = BRW_OPCODE_NOP; + this->saturate = false; + this->conditional_mod = BRW_CONDITIONAL_NONE; + this->predicated = false; + this->sampler = 0; + this->target = 0; + this->eot = false; + this->header_present = false; + this->shadow_compare = false; + this->mlen = 0; + this->base_mrf = 0; + } + + fs_inst() + { + init(); + } + + fs_inst(int opcode) + { + init(); + this->opcode = opcode; + } + + fs_inst(int opcode, fs_reg dst) + { + init(); + this->opcode = opcode; + this->dst = dst; + + if (dst.file == GRF) + assert(dst.reg_offset >= 0); + } + + fs_inst(int opcode, fs_reg dst, fs_reg src0) + { + init(); + this->opcode = opcode; + this->dst = dst; + this->src[0] = src0; + + if (dst.file == GRF) + assert(dst.reg_offset >= 0); + if (src[0].file == GRF) + assert(src[0].reg_offset >= 0); + } + + fs_inst(int opcode, fs_reg dst, fs_reg src0, fs_reg src1) + { + init(); + this->opcode = opcode; + this->dst = dst; + this->src[0] = src0; + this->src[1] = src1; + + if (dst.file == GRF) + assert(dst.reg_offset >= 0); + if (src[0].file == GRF) + assert(src[0].reg_offset >= 0); + if (src[1].file == GRF) + assert(src[1].reg_offset >= 0); + } + + fs_inst(int opcode, fs_reg dst, fs_reg src0, fs_reg src1, fs_reg src2) + { + init(); + this->opcode = opcode; + this->dst = dst; + this->src[0] = src0; + this->src[1] = src1; + this->src[2] = src2; + + if (dst.file == GRF) + assert(dst.reg_offset >= 0); + if (src[0].file == GRF) + assert(src[0].reg_offset >= 0); + if (src[1].file == GRF) + assert(src[1].reg_offset >= 0); + if (src[2].file == GRF) + assert(src[2].reg_offset >= 0); + } + + int opcode; /* BRW_OPCODE_* or FS_OPCODE_* */ + fs_reg dst; + fs_reg src[3]; + bool saturate; + bool predicated; + int conditional_mod; /**< BRW_CONDITIONAL_* */ + + int mlen; /**< SEND message length */ + int base_mrf; /**< First MRF in the SEND message, if mlen is nonzero. */ + int sampler; + int target; /**< MRT target. */ + bool eot; + bool header_present; + bool shadow_compare; + + /** @{ + * Annotation for the generated IR. One of the two can be set. + */ + ir_instruction *ir; + const char *annotation; + /** @} */ +}; + +class fs_visitor : public ir_visitor +{ +public: + + fs_visitor(struct brw_wm_compile *c, struct brw_shader *shader) + { + this->c = c; + this->p = &c->func; + this->brw = p->brw; + this->fp = brw->fragment_program; + this->intel = &brw->intel; + this->ctx = &intel->ctx; + this->mem_ctx = talloc_new(NULL); + this->shader = shader; + this->fail = false; + this->variable_ht = hash_table_ctor(0, + hash_table_pointer_hash, + hash_table_pointer_compare); + + this->frag_color = NULL; + this->frag_data = NULL; + this->frag_depth = NULL; + this->first_non_payload_grf = 0; + + this->current_annotation = NULL; + this->annotation_string = NULL; + this->annotation_ir = NULL; + this->base_ir = NULL; + + this->virtual_grf_sizes = NULL; + this->virtual_grf_next = 1; + this->virtual_grf_array_size = 0; + this->virtual_grf_def = NULL; + this->virtual_grf_use = NULL; + + this->kill_emitted = false; + } + + ~fs_visitor() + { + talloc_free(this->mem_ctx); + hash_table_dtor(this->variable_ht); + } + + fs_reg *variable_storage(ir_variable *var); + int virtual_grf_alloc(int size); + + void visit(ir_variable *ir); + void visit(ir_assignment *ir); + void visit(ir_dereference_variable *ir); + void visit(ir_dereference_record *ir); + void visit(ir_dereference_array *ir); + void visit(ir_expression *ir); + void visit(ir_texture *ir); + void visit(ir_if *ir); + void visit(ir_constant *ir); + void visit(ir_swizzle *ir); + void visit(ir_return *ir); + void visit(ir_loop *ir); + void visit(ir_loop_jump *ir); + void visit(ir_discard *ir); + void visit(ir_call *ir); + void visit(ir_function *ir); + void visit(ir_function_signature *ir); + + fs_inst *emit(fs_inst inst); + void assign_curb_setup(); + void calculate_urb_setup(); + void assign_urb_setup(); + void assign_regs(); + void assign_regs_trivial(); + void split_virtual_grfs(); + void calculate_live_intervals(); + bool propagate_constants(); + bool register_coalesce(); + bool compute_to_mrf(); + bool dead_code_eliminate(); + bool virtual_grf_interferes(int a, int b); + void generate_code(); + void generate_fb_write(fs_inst *inst); + void generate_linterp(fs_inst *inst, struct brw_reg dst, + struct brw_reg *src); + void generate_tex(fs_inst *inst, struct brw_reg dst); + void generate_math(fs_inst *inst, struct brw_reg dst, struct brw_reg *src); + void generate_discard_not(fs_inst *inst, struct brw_reg temp); + void generate_discard_and(fs_inst *inst, struct brw_reg temp); + void generate_ddx(fs_inst *inst, struct brw_reg dst, struct brw_reg src); + void generate_ddy(fs_inst *inst, struct brw_reg dst, struct brw_reg src); + + void emit_dummy_fs(); + fs_reg *emit_fragcoord_interpolation(ir_variable *ir); + fs_reg *emit_frontfacing_interpolation(ir_variable *ir); + fs_reg *emit_general_interpolation(ir_variable *ir); + void emit_interpolation_setup_gen4(); + void emit_interpolation_setup_gen6(); + fs_inst *emit_texture_gen4(ir_texture *ir, fs_reg dst, fs_reg coordinate); + fs_inst *emit_texture_gen5(ir_texture *ir, fs_reg dst, fs_reg coordinate); + fs_inst *emit_math(fs_opcodes op, fs_reg dst, fs_reg src0); + fs_inst *emit_math(fs_opcodes op, fs_reg dst, fs_reg src0, fs_reg src1); + void emit_bool_to_cond_code(ir_rvalue *condition); + + void emit_fb_writes(); + void emit_assignment_writes(fs_reg &l, fs_reg &r, + const glsl_type *type, bool predicated); + + struct brw_reg interp_reg(int location, int channel); + int setup_uniform_values(int loc, const glsl_type *type); + void setup_builtin_uniform_values(ir_variable *ir); + + struct brw_context *brw; + const struct gl_fragment_program *fp; + struct intel_context *intel; + struct gl_context *ctx; + struct brw_wm_compile *c; + struct brw_compile *p; + struct brw_shader *shader; + void *mem_ctx; + exec_list instructions; + + int *virtual_grf_sizes; + int virtual_grf_next; + int virtual_grf_array_size; + int *virtual_grf_def; + int *virtual_grf_use; + + struct hash_table *variable_ht; + ir_variable *frag_color, *frag_data, *frag_depth; + int first_non_payload_grf; + int urb_setup[FRAG_ATTRIB_MAX]; + bool kill_emitted; + + /** @{ debug annotation info */ + const char *current_annotation; + ir_instruction *base_ir; + const char **annotation_string; + ir_instruction **annotation_ir; + /** @} */ + + bool fail; + + /* Result of last visit() method. */ + fs_reg result; + + fs_reg pixel_x; + fs_reg pixel_y; + fs_reg wpos_w; + fs_reg pixel_w; + fs_reg delta_x; + fs_reg delta_y; + + int grf_used; +}; + +GLboolean brw_do_channel_expressions(struct exec_list *instructions); +GLboolean brw_do_vector_splitting(struct exec_list *instructions); diff --git a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp index 478614090a..4aac1b5a05 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp @@ -83,7 +83,6 @@ channel_expressions_predicate(ir_instruction *ir) return false; } -extern "C" { GLboolean brw_do_channel_expressions(exec_list *instructions) { @@ -99,7 +98,6 @@ brw_do_channel_expressions(exec_list *instructions) return v.progress; } -} ir_rvalue * ir_channel_expressions_visitor::get_element(ir_variable *var, unsigned int elem) @@ -119,7 +117,6 @@ ir_channel_expressions_visitor::assign(ir_assignment *ir, int elem, ir_rvalue *v { ir_dereference *lhs = ir->lhs->clone(mem_ctx, NULL); ir_assignment *assign; - ir_swizzle *val_swiz; /* This assign-of-expression should have been generated by the * expression flattening visitor (since we never short circit to @@ -128,10 +125,7 @@ ir_channel_expressions_visitor::assign(ir_assignment *ir, int elem, ir_rvalue *v */ assert(ir->write_mask == (1 << ir->lhs->type->components()) - 1); - /* Smear the float across all the channels for the masked write. */ - val_swiz = new(mem_ctx) ir_swizzle(val, 0, 0, 0, 0, - ir->lhs->type->components()); - assign = new(mem_ctx) ir_assignment(lhs, val_swiz, NULL, (1 << elem)); + assign = new(mem_ctx) ir_assignment(lhs, val, NULL, (1 << elem)); ir->insert_before(assign); } @@ -235,6 +229,12 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir) case ir_binop_bit_and: case ir_binop_bit_xor: case ir_binop_bit_or: + case ir_binop_less: + case ir_binop_greater: + case ir_binop_lequal: + case ir_binop_gequal: + case ir_binop_equal: + case ir_binop_nequal: for (i = 0; i < vector_elements; i++) { ir_rvalue *op0 = get_element(op_var[0], i); ir_rvalue *op1 = get_element(op_var[1], i); @@ -315,10 +315,6 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir) break; } - case ir_binop_less: - case ir_binop_greater: - case ir_binop_lequal: - case ir_binop_gequal: case ir_binop_logic_and: case ir_binop_logic_xor: case ir_binop_logic_or: @@ -326,8 +322,8 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir) printf("\n"); assert(!"not reached: expression operates on scalars only"); break; - case ir_binop_equal: - case ir_binop_nequal: { + case ir_binop_all_equal: + case ir_binop_any_nequal: { ir_expression *last = NULL; for (i = 0; i < vector_elements; i++) { ir_rvalue *op0 = get_element(op_var[0], i); @@ -335,7 +331,7 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir) ir_expression *temp; ir_expression_operation join; - if (expr->operation == ir_binop_equal) + if (expr->operation == ir_binop_all_equal) join = ir_binop_logic_and; else join = ir_binop_logic_or; diff --git a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp index 00d5c20248..2be6b08b5c 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp @@ -212,7 +212,6 @@ public: struct variable_entry *get_splitting_entry(ir_variable *var); exec_list *variable_list; - void *mem_ctx; }; struct variable_entry * @@ -264,37 +263,43 @@ ir_vector_splitting_visitor::visit_leave(ir_assignment *ir) variable_entry *rhs = rhs_deref ? get_splitting_entry(rhs_deref->var) : NULL; if (lhs_deref && rhs_deref && (lhs || rhs) && !ir->condition) { + unsigned int rhs_chan = 0; + /* Straight assignment of vector variables. */ - for (unsigned int i = 0; i < ir->rhs->type->vector_elements; i++) { + for (unsigned int i = 0; i < ir->lhs->type->vector_elements; i++) { ir_dereference *new_lhs; ir_rvalue *new_rhs; void *mem_ctx = lhs ? lhs->mem_ctx : rhs->mem_ctx; unsigned int writemask; + if (!(ir->write_mask & (1 << i))) + continue; + if (lhs) { new_lhs = new(mem_ctx) ir_dereference_variable(lhs->components[i]); - writemask = (ir->write_mask >> i) & 1; + writemask = 1; } else { new_lhs = ir->lhs->clone(mem_ctx, NULL); - writemask = ir->write_mask & (1 << i); + writemask = 1 << i; } if (rhs) { - new_rhs = new(mem_ctx) ir_dereference_variable(rhs->components[i]); - /* If we're writing into a writemask, smear it out to that channel. */ - if (!lhs) - new_rhs = new(mem_ctx) ir_swizzle(new_rhs, i, i, i, i, i + 1); + new_rhs = + new(mem_ctx) ir_dereference_variable(rhs->components[rhs_chan]); } else { new_rhs = new(mem_ctx) ir_swizzle(ir->rhs->clone(mem_ctx, NULL), - i, i, i, i, 1); + rhs_chan, 0, 0, 0, 1); } ir->insert_before(new(mem_ctx) ir_assignment(new_lhs, new_rhs, NULL, writemask)); + + rhs_chan++; } ir->remove(); } else if (lhs) { + void *mem_ctx = lhs->mem_ctx; int elem = -1; switch (ir->write_mask) { @@ -319,8 +324,6 @@ ir_vector_splitting_visitor::visit_leave(ir_assignment *ir) ir->write_mask = (1 << 0); handle_rvalue(&ir->rhs); - ir->rhs = new(mem_ctx) ir_swizzle(ir->rhs, - elem, elem, elem, elem, 1); } else { handle_rvalue(&ir->rhs); } @@ -330,7 +333,6 @@ ir_vector_splitting_visitor::visit_leave(ir_assignment *ir) return visit_continue; } -extern "C" { bool brw_do_vector_splitting(exec_list *instructions) { @@ -388,4 +390,3 @@ brw_do_vector_splitting(exec_list *instructions) return true; } -} diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c index 5409e55788..cfcc8ea4d6 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.c +++ b/src/mesa/drivers/dri/i965/brw_gs.c @@ -60,7 +60,7 @@ static void compile_gs_prog( struct brw_context *brw, */ c.nr_attrs = brw_count_bits(c.key.attrs); - if (intel->gen == 5) + if (intel->gen >= 5) c.nr_regs = (c.nr_attrs + 1) / 2 + 3; /* are vertices packed, or reg-aligned? */ else c.nr_regs = (c.nr_attrs + 1) / 2 + 1; /* are vertices packed, or reg-aligned? */ @@ -85,9 +85,14 @@ static void compile_gs_prog( struct brw_context *brw, */ switch (key->primitive) { case GL_QUADS: + /* Gen6: VF has already converted into polygon. */ + if (intel->gen == 6) + return; brw_gs_quads( &c, key ); break; case GL_QUAD_STRIP: + if (intel->gen == 6) + return; brw_gs_quad_strip( &c, key ); break; case GL_LINE_LOOP: @@ -160,7 +165,7 @@ static const GLenum gs_prim[GL_POLYGON+1] = { static void populate_key( struct brw_context *brw, struct brw_gs_prog_key *key ) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; memset(key, 0, sizeof(*key)); /* CACHE_NEW_VS_PROG */ diff --git a/src/mesa/drivers/dri/i965/brw_gs.h b/src/mesa/drivers/dri/i965/brw_gs.h index 813b8d447a..7e3531086f 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.h +++ b/src/mesa/drivers/dri/i965/brw_gs.h @@ -56,6 +56,7 @@ struct brw_gs_compile { struct { struct brw_reg R0; struct brw_reg vertex[MAX_GS_VERTS]; + struct brw_reg temp; } reg; /* 3 different ways of expressing vertex size: diff --git a/src/mesa/drivers/dri/i965/brw_gs_emit.c b/src/mesa/drivers/dri/i965/brw_gs_emit.c index a01d5576f8..e1f751fdaa 100644 --- a/src/mesa/drivers/dri/i965/brw_gs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_gs_emit.c @@ -58,6 +58,8 @@ static void brw_gs_alloc_regs( struct brw_gs_compile *c, i += c->nr_regs; } + c->reg.temp = brw_vec8_grf(i, 0); + c->prog_data.urb_read_length = c->nr_regs; c->prog_data.total_grf = i; } @@ -69,12 +71,22 @@ static void brw_gs_emit_vue(struct brw_gs_compile *c, GLuint header) { struct brw_compile *p = &c->func; + struct intel_context *intel = &c->func.brw->intel; GLboolean allocate = !last; + struct brw_reg temp; + + if (intel->gen < 6) + temp = c->reg.R0; + else { + temp = c->reg.temp; + brw_MOV(p, retype(temp, BRW_REGISTER_TYPE_UD), + retype(c->reg.R0, BRW_REGISTER_TYPE_UD)); + } /* Overwrite PrimType and PrimStart in the message header, for * each vertex in turn: */ - brw_MOV(p, get_element_ud(c->reg.R0, 2), brw_imm_ud(header)); + brw_MOV(p, get_element_ud(temp, 2), brw_imm_ud(header)); /* Copy the vertex from vertn into m1..mN+1: */ @@ -87,9 +99,9 @@ static void brw_gs_emit_vue(struct brw_gs_compile *c, * allocated each time. */ brw_urb_WRITE(p, - allocate ? c->reg.R0 : retype(brw_null_reg(), BRW_REGISTER_TYPE_UD), + allocate ? temp : retype(brw_null_reg(), BRW_REGISTER_TYPE_UD), 0, - c->reg.R0, + temp, allocate, 1, /* used */ c->nr_regs + 1, /* msg length */ @@ -98,19 +110,39 @@ static void brw_gs_emit_vue(struct brw_gs_compile *c, 1, /* writes_complete */ 0, /* urb offset */ BRW_URB_SWIZZLE_NONE); + + if (intel->gen >= 6 && allocate) + brw_MOV(p, get_element_ud(c->reg.R0, 0), get_element_ud(temp, 0)); } static void brw_gs_ff_sync(struct brw_gs_compile *c, int num_prim) { struct brw_compile *p = &c->func; - brw_MOV(p, get_element_ud(c->reg.R0, 1), brw_imm_ud(num_prim)); - brw_ff_sync(p, - c->reg.R0, - 0, - c->reg.R0, - 1, /* allocate */ - 1, /* response length */ - 0 /* eot */); + struct intel_context *intel = &c->func.brw->intel; + + if (intel->gen < 6) { + brw_MOV(p, get_element_ud(c->reg.R0, 1), brw_imm_ud(num_prim)); + brw_ff_sync(p, + c->reg.R0, + 0, + c->reg.R0, + 1, /* allocate */ + 1, /* response length */ + 0 /* eot */); + } else { + brw_MOV(p, retype(c->reg.temp, BRW_REGISTER_TYPE_UD), + retype(c->reg.R0, BRW_REGISTER_TYPE_UD)); + brw_MOV(p, get_element_ud(c->reg.temp, 1), brw_imm_ud(num_prim)); + brw_ff_sync(p, + c->reg.temp, + 0, + c->reg.temp, + 1, /* allocate */ + 1, /* response length */ + 0 /* eot */); + brw_MOV(p, get_element_ud(c->reg.R0, 0), + get_element_ud(c->reg.temp, 0)); + } } diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c index 6eeaba7772..27d161db41 100644 --- a/src/mesa/drivers/dri/i965/brw_misc_state.c +++ b/src/mesa/drivers/dri/i965/brw_misc_state.c @@ -48,7 +48,7 @@ static void upload_blend_constant_color(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct brw_blend_constant_color bcc; memset(&bcc, 0, sizeof(bcc)); @@ -76,7 +76,7 @@ const struct brw_tracked_state brw_blend_constant_color = { static void upload_drawing_rect(struct brw_context *brw) { struct intel_context *intel = &brw->intel; - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; BEGIN_BATCH(4); OUT_BATCH(_3DSTATE_DRAWRECT_INFO_I965); @@ -335,7 +335,7 @@ const struct brw_tracked_state brw_depthbuffer = { static void upload_polygon_stipple(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct brw_polygon_stipple bps; GLuint i; @@ -378,7 +378,7 @@ const struct brw_tracked_state brw_polygon_stipple = { static void upload_polygon_stipple_offset(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct brw_polygon_stipple_offset bpso; memset(&bpso, 0, sizeof(bpso)); @@ -449,7 +449,7 @@ const struct brw_tracked_state brw_aa_line_parameters = { static void upload_line_stipple(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct brw_line_stipple bls; GLfloat tmp; GLint tmpi; diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index 3e52be5d4b..1367d81469 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -41,7 +41,7 @@ #include "brw_context.h" #include "brw_wm.h" -static void brwBindProgram( GLcontext *ctx, +static void brwBindProgram( struct gl_context *ctx, GLenum target, struct gl_program *prog ) { @@ -57,7 +57,7 @@ static void brwBindProgram( GLcontext *ctx, } } -static struct gl_program *brwNewProgram( GLcontext *ctx, +static struct gl_program *brwNewProgram( struct gl_context *ctx, GLenum target, GLuint id ) { @@ -93,14 +93,14 @@ static struct gl_program *brwNewProgram( GLcontext *ctx, } } -static void brwDeleteProgram( GLcontext *ctx, +static void brwDeleteProgram( struct gl_context *ctx, struct gl_program *prog ) { _mesa_delete_program( ctx, prog ); } -static GLboolean brwIsProgramNative( GLcontext *ctx, +static GLboolean brwIsProgramNative( struct gl_context *ctx, GLenum target, struct gl_program *prog ) { @@ -108,7 +108,7 @@ static GLboolean brwIsProgramNative( GLcontext *ctx, } static void -shader_error(GLcontext *ctx, struct gl_program *prog, const char *msg) +shader_error(struct gl_context *ctx, struct gl_program *prog, const char *msg) { struct gl_shader_program *shader; @@ -120,7 +120,7 @@ shader_error(GLcontext *ctx, struct gl_program *prog, const char *msg) } } -static GLboolean brwProgramStringNotify( GLcontext *ctx, +static GLboolean brwProgramStringNotify( struct gl_context *ctx, GLenum target, struct gl_program *prog ) { @@ -148,15 +148,9 @@ static GLboolean brwProgramStringNotify( GLcontext *ctx, * using the new FS backend. */ shader_program = _mesa_lookup_shader_program(ctx, prog->Id); - if (shader_program) { - for (i = 0; i < shader_program->_NumLinkedShaders; i++) { - struct brw_shader *shader; - - shader = (struct brw_shader *)shader_program->_LinkedShaders[i]; - if (shader->base.Type == GL_FRAGMENT_SHADER && shader->ir) { - return GL_TRUE; - } - } + if (shader_program + && shader_program->_LinkedShaders[MESA_SHADER_FRAGMENT]) { + return GL_TRUE; } } else if (target == GL_VERTEX_PROGRAM_ARB) { diff --git a/src/mesa/drivers/dri/i965/brw_queryobj.c b/src/mesa/drivers/dri/i965/brw_queryobj.c index f6868c83ac..f28f28663e 100644 --- a/src/mesa/drivers/dri/i965/brw_queryobj.c +++ b/src/mesa/drivers/dri/i965/brw_queryobj.c @@ -72,7 +72,7 @@ brw_queryobj_get_results(struct brw_query_object *query) } static struct gl_query_object * -brw_new_query_object(GLcontext *ctx, GLuint id) +brw_new_query_object(struct gl_context *ctx, GLuint id) { struct brw_query_object *query; @@ -87,7 +87,7 @@ brw_new_query_object(GLcontext *ctx, GLuint id) } static void -brw_delete_query(GLcontext *ctx, struct gl_query_object *q) +brw_delete_query(struct gl_context *ctx, struct gl_query_object *q) { struct brw_query_object *query = (struct brw_query_object *)q; @@ -96,7 +96,7 @@ brw_delete_query(GLcontext *ctx, struct gl_query_object *q) } static void -brw_begin_query(GLcontext *ctx, struct gl_query_object *q) +brw_begin_query(struct gl_context *ctx, struct gl_query_object *q) { struct brw_context *brw = brw_context(ctx); struct intel_context *intel = intel_context(ctx); @@ -107,16 +107,29 @@ brw_begin_query(GLcontext *ctx, struct gl_query_object *q) query->bo = drm_intel_bo_alloc(intel->bufmgr, "timer query", 4096, 4096); - BEGIN_BATCH(4); - OUT_BATCH(_3DSTATE_PIPE_CONTROL | - PIPE_CONTROL_WRITE_TIMESTAMP); - OUT_RELOC(query->bo, - I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION, - PIPE_CONTROL_GLOBAL_GTT_WRITE | - 0); - OUT_BATCH(0); - OUT_BATCH(0); - ADVANCE_BATCH(); + if (intel->gen >= 6) { + BEGIN_BATCH(4); + OUT_BATCH(_3DSTATE_PIPE_CONTROL); + OUT_BATCH(PIPE_CONTROL_WRITE_TIMESTAMP); + OUT_RELOC(query->bo, + I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION, + PIPE_CONTROL_GLOBAL_GTT_WRITE | + 0); + OUT_BATCH(0); + ADVANCE_BATCH(); + + } else { + BEGIN_BATCH(4); + OUT_BATCH(_3DSTATE_PIPE_CONTROL | + PIPE_CONTROL_WRITE_TIMESTAMP); + OUT_RELOC(query->bo, + I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION, + PIPE_CONTROL_GLOBAL_GTT_WRITE | + 0); + OUT_BATCH(0); + OUT_BATCH(0); + ADVANCE_BATCH(); + } } else { /* Reset our driver's tracking of query state. */ drm_intel_bo_unreference(query->bo); @@ -133,23 +146,36 @@ brw_begin_query(GLcontext *ctx, struct gl_query_object *q) * Begin the ARB_occlusion_query query on a query object. */ static void -brw_end_query(GLcontext *ctx, struct gl_query_object *q) +brw_end_query(struct gl_context *ctx, struct gl_query_object *q) { struct brw_context *brw = brw_context(ctx); struct intel_context *intel = intel_context(ctx); struct brw_query_object *query = (struct brw_query_object *)q; if (query->Base.Target == GL_TIME_ELAPSED_EXT) { - BEGIN_BATCH(4); - OUT_BATCH(_3DSTATE_PIPE_CONTROL | - PIPE_CONTROL_WRITE_TIMESTAMP); - OUT_RELOC(query->bo, - I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION, - PIPE_CONTROL_GLOBAL_GTT_WRITE | - 8); - OUT_BATCH(0); - OUT_BATCH(0); - ADVANCE_BATCH(); + if (intel->gen >= 6) { + BEGIN_BATCH(4); + OUT_BATCH(_3DSTATE_PIPE_CONTROL); + OUT_BATCH(PIPE_CONTROL_WRITE_TIMESTAMP); + OUT_RELOC(query->bo, + I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION, + PIPE_CONTROL_GLOBAL_GTT_WRITE | + 8); + OUT_BATCH(0); + ADVANCE_BATCH(); + + } else { + BEGIN_BATCH(4); + OUT_BATCH(_3DSTATE_PIPE_CONTROL | + PIPE_CONTROL_WRITE_TIMESTAMP); + OUT_RELOC(query->bo, + I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION, + PIPE_CONTROL_GLOBAL_GTT_WRITE | + 8); + OUT_BATCH(0); + OUT_BATCH(0); + ADVANCE_BATCH(); + } intel_batchbuffer_flush(intel->batch); } else { @@ -171,7 +197,7 @@ brw_end_query(GLcontext *ctx, struct gl_query_object *q) } } -static void brw_wait_query(GLcontext *ctx, struct gl_query_object *q) +static void brw_wait_query(struct gl_context *ctx, struct gl_query_object *q) { struct brw_query_object *query = (struct brw_query_object *)q; @@ -179,7 +205,7 @@ static void brw_wait_query(GLcontext *ctx, struct gl_query_object *q) query->Base.Ready = GL_TRUE; } -static void brw_check_query(GLcontext *ctx, struct gl_query_object *q) +static void brw_check_query(struct gl_context *ctx, struct gl_query_object *q) { struct brw_query_object *query = (struct brw_query_object *)q; @@ -223,22 +249,43 @@ brw_emit_query_begin(struct brw_context *brw) if (!query || brw->query.active) return; - BEGIN_BATCH(4); - OUT_BATCH(_3DSTATE_PIPE_CONTROL | - PIPE_CONTROL_DEPTH_STALL | - PIPE_CONTROL_WRITE_DEPTH_COUNT); - /* This object could be mapped cacheable, but we don't have an exposed - * mechanism to support that. Since it's going uncached, tell GEM that - * we're writing to it. The usual clflush should be all that's required - * to pick up the results. - */ - OUT_RELOC(brw->query.bo, - I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION, - PIPE_CONTROL_GLOBAL_GTT_WRITE | - ((brw->query.index * 2) * sizeof(uint64_t))); - OUT_BATCH(0); - OUT_BATCH(0); - ADVANCE_BATCH(); + if (intel->gen >= 6) { + BEGIN_BATCH(8); + + /* workaround: CS stall required before depth stall. */ + OUT_BATCH(_3DSTATE_PIPE_CONTROL); + OUT_BATCH(PIPE_CONTROL_CS_STALL); + OUT_BATCH(0); /* write address */ + OUT_BATCH(0); /* write data */ + + OUT_BATCH(_3DSTATE_PIPE_CONTROL); + OUT_BATCH(PIPE_CONTROL_DEPTH_STALL | + PIPE_CONTROL_WRITE_DEPTH_COUNT); + OUT_RELOC(brw->query.bo, + I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION, + PIPE_CONTROL_GLOBAL_GTT_WRITE | + ((brw->query.index * 2) * sizeof(uint64_t))); + OUT_BATCH(0); + ADVANCE_BATCH(); + + } else { + BEGIN_BATCH(4); + OUT_BATCH(_3DSTATE_PIPE_CONTROL | + PIPE_CONTROL_DEPTH_STALL | + PIPE_CONTROL_WRITE_DEPTH_COUNT); + /* This object could be mapped cacheable, but we don't have an exposed + * mechanism to support that. Since it's going uncached, tell GEM that + * we're writing to it. The usual clflush should be all that's required + * to pick up the results. + */ + OUT_RELOC(brw->query.bo, + I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION, + PIPE_CONTROL_GLOBAL_GTT_WRITE | + ((brw->query.index * 2) * sizeof(uint64_t))); + OUT_BATCH(0); + OUT_BATCH(0); + ADVANCE_BATCH(); + } if (query->bo != brw->query.bo) { if (query->bo != NULL) @@ -260,17 +307,37 @@ brw_emit_query_end(struct brw_context *brw) if (!brw->query.active) return; - BEGIN_BATCH(4); - OUT_BATCH(_3DSTATE_PIPE_CONTROL | - PIPE_CONTROL_DEPTH_STALL | - PIPE_CONTROL_WRITE_DEPTH_COUNT); - OUT_RELOC(brw->query.bo, - I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION, - PIPE_CONTROL_GLOBAL_GTT_WRITE | - ((brw->query.index * 2 + 1) * sizeof(uint64_t))); - OUT_BATCH(0); - OUT_BATCH(0); - ADVANCE_BATCH(); + if (intel->gen >= 6) { + BEGIN_BATCH(8); + /* workaround: CS stall required before depth stall. */ + OUT_BATCH(_3DSTATE_PIPE_CONTROL); + OUT_BATCH(PIPE_CONTROL_CS_STALL); + OUT_BATCH(0); /* write address */ + OUT_BATCH(0); /* write data */ + + OUT_BATCH(_3DSTATE_PIPE_CONTROL); + OUT_BATCH(PIPE_CONTROL_DEPTH_STALL | + PIPE_CONTROL_WRITE_DEPTH_COUNT); + OUT_RELOC(brw->query.bo, + I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION, + PIPE_CONTROL_GLOBAL_GTT_WRITE | + ((brw->query.index * 2 + 1) * sizeof(uint64_t))); + OUT_BATCH(0); + ADVANCE_BATCH(); + + } else { + BEGIN_BATCH(4); + OUT_BATCH(_3DSTATE_PIPE_CONTROL | + PIPE_CONTROL_DEPTH_STALL | + PIPE_CONTROL_WRITE_DEPTH_COUNT); + OUT_RELOC(brw->query.bo, + I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION, + PIPE_CONTROL_GLOBAL_GTT_WRITE | + ((brw->query.index * 2 + 1) * sizeof(uint64_t))); + OUT_BATCH(0); + OUT_BATCH(0); + ADVANCE_BATCH(); + } brw->query.active = GL_FALSE; brw->query.index++; diff --git a/src/mesa/drivers/dri/i965/brw_sf.c b/src/mesa/drivers/dri/i965/brw_sf.c index 7d005d278f..7dbd70daae 100644 --- a/src/mesa/drivers/dri/i965/brw_sf.c +++ b/src/mesa/drivers/dri/i965/brw_sf.c @@ -132,7 +132,7 @@ static void compile_sf_prog( struct brw_context *brw, */ static void upload_sf_prog(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct brw_sf_prog_key key; memset(&key, 0, sizeof(key)); diff --git a/src/mesa/drivers/dri/i965/brw_sf_state.c b/src/mesa/drivers/dri/i965/brw_sf_state.c index 914f275cc6..6ad9e1b48a 100644 --- a/src/mesa/drivers/dri/i965/brw_sf_state.c +++ b/src/mesa/drivers/dri/i965/brw_sf_state.c @@ -38,7 +38,7 @@ static void upload_sf_vp(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; const GLfloat depth_scale = 1.0F / ctx->DrawBuffer->_DepthMaxF; struct brw_sf_viewport sfv; GLfloat y_scale, y_bias; @@ -139,7 +139,7 @@ struct brw_sf_unit_key { static void sf_unit_populate_key(struct brw_context *brw, struct brw_sf_unit_key *key) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; memset(key, 0, sizeof(*key)); /* CACHE_NEW_SF_PROG */ diff --git a/src/mesa/drivers/dri/i965/brw_state.c b/src/mesa/drivers/dri/i965/brw_state.c index 1e77e427d3..13b231d5cf 100644 --- a/src/mesa/drivers/dri/i965/brw_state.c +++ b/src/mesa/drivers/dri/i965/brw_state.c @@ -28,7 +28,7 @@ #include "brw_context.h" void -brw_enable(GLcontext *ctx, GLenum cap, GLboolean state) +brw_enable(struct gl_context *ctx, GLenum cap, GLboolean state) { struct brw_context *brw = brw_context(ctx); @@ -40,7 +40,7 @@ brw_enable(GLcontext *ctx, GLenum cap, GLboolean state) } void -brw_depth_range(GLcontext *ctx, GLclampd nearval, GLclampd farval) +brw_depth_range(struct gl_context *ctx, GLclampd nearval, GLclampd farval) { struct brw_context *brw = brw_context(ctx); diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index c5d296b129..3beed16945 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -102,6 +102,7 @@ extern const struct brw_tracked_state gen6_depth_stencil_state; extern const struct brw_tracked_state gen6_gs_state; extern const struct brw_tracked_state gen6_sampler_state; extern const struct brw_tracked_state gen6_scissor_state; +extern const struct brw_tracked_state gen6_scissor_state_pointers; extern const struct brw_tracked_state gen6_sf_state; extern const struct brw_tracked_state gen6_sf_vp; extern const struct brw_tracked_state gen6_urb; diff --git a/src/mesa/drivers/dri/i965/brw_state_dump.c b/src/mesa/drivers/dri/i965/brw_state_dump.c index d410861bdf..b79b33c2e3 100644 --- a/src/mesa/drivers/dri/i965/brw_state_dump.c +++ b/src/mesa/drivers/dri/i965/brw_state_dump.c @@ -161,6 +161,123 @@ static void dump_sf_viewport_state(struct brw_context *brw) drm_intel_bo_unmap(brw->sf.vp_bo); } +static void dump_clip_viewport_state(struct brw_context *brw) +{ + const char *name = "CLIP VP"; + struct brw_clipper_viewport *vp; + uint32_t vp_off; + + if (brw->clip.vp_bo == NULL) + return; + + drm_intel_bo_map(brw->clip.vp_bo, GL_FALSE); + + vp = brw->clip.vp_bo->virtual; + vp_off = brw->clip.vp_bo->offset; + + state_out(name, vp, vp_off, 0, "xmin = %f\n", vp->xmin); + state_out(name, vp, vp_off, 1, "xmax = %f\n", vp->xmax); + state_out(name, vp, vp_off, 2, "ymin = %f\n", vp->ymin); + state_out(name, vp, vp_off, 3, "ymax = %f\n", vp->ymax); + drm_intel_bo_unmap(brw->clip.vp_bo); +} + +static void dump_cc_viewport_state(struct brw_context *brw) +{ + const char *name = "CC VP"; + struct brw_cc_viewport *vp; + uint32_t vp_off; + + if (brw->cc.vp_bo == NULL) + return; + + drm_intel_bo_map(brw->cc.vp_bo, GL_FALSE); + + vp = brw->cc.vp_bo->virtual; + vp_off = brw->cc.vp_bo->offset; + + state_out(name, vp, vp_off, 0, "min_depth = %f\n", vp->min_depth); + state_out(name, vp, vp_off, 1, "max_depth = %f\n", vp->max_depth); + drm_intel_bo_unmap(brw->cc.vp_bo); +} + +static void dump_depth_stencil_state(struct brw_context *brw) +{ + const char *name = "DEPTH STENCIL"; + struct gen6_depth_stencil_state *ds; + uint32_t ds_off; + + if (brw->cc.depth_stencil_state_bo == NULL) + return; + + drm_intel_bo_map(brw->cc.depth_stencil_state_bo, GL_FALSE); + + ds = brw->cc.depth_stencil_state_bo->virtual; + ds_off = brw->cc.depth_stencil_state_bo->offset; + + state_out(name, ds, ds_off, 0, "stencil %sable, func %d, write %sable\n", + ds->ds0.stencil_enable ? "en" : "dis", + ds->ds0.stencil_func, + ds->ds0.stencil_write_enable ? "en" : "dis"); + state_out(name, ds, ds_off, 1, "stencil test mask 0x%x, write mask 0x%x\n", + ds->ds1.stencil_test_mask, ds->ds1.stencil_write_mask); + state_out(name, ds, ds_off, 2, "depth test %sable, func %d, write %sable\n", + ds->ds2.depth_test_enable ? "en" : "dis", + ds->ds2.depth_test_func, + ds->ds2.depth_write_enable ? "en" : "dis"); + drm_intel_bo_unmap(brw->cc.depth_stencil_state_bo); +} + +static void dump_cc_state(struct brw_context *brw) +{ + const char *name = "CC"; + struct gen6_color_calc_state *cc; + uint32_t cc_off; + + if (brw->cc.state_bo == NULL) + return; + + drm_intel_bo_map(brw->cc.state_bo, GL_FALSE); + cc = brw->cc.state_bo->virtual; + cc_off = brw->cc.state_bo->offset; + + state_out(name, cc, cc_off, 0, "alpha test format %s, round disable %d, stencil ref %d," + "bf stencil ref %d\n", + cc->cc0.alpha_test_format ? "FLOAT32" : "UNORM8", + cc->cc0.round_disable, + cc->cc0.stencil_ref, + cc->cc0.bf_stencil_ref); + state_out(name, cc, cc_off, 1, "\n"); + state_out(name, cc, cc_off, 2, "constant red %f\n", cc->constant_r); + state_out(name, cc, cc_off, 3, "constant green %f\n", cc->constant_g); + state_out(name, cc, cc_off, 4, "constant blue %f\n", cc->constant_b); + state_out(name, cc, cc_off, 5, "constant alpha %f\n", cc->constant_a); + + drm_intel_bo_unmap(brw->cc.state_bo); + +} + +static void dump_blend_state(struct brw_context *brw) +{ + const char *name = "BLEND"; + struct gen6_blend_state *blend; + uint32_t blend_off; + + if (brw->cc.blend_state_bo == NULL) + return; + + drm_intel_bo_map(brw->cc.blend_state_bo, GL_FALSE); + + blend = brw->cc.blend_state_bo->virtual; + blend_off = brw->cc.blend_state_bo->offset; + + state_out(name, blend, blend_off, 0, "\n"); + state_out(name, blend, blend_off, 1, "\n"); + + drm_intel_bo_unmap(brw->cc.blend_state_bo); + +} + static void brw_debug_prog(const char *name, drm_intel_bo *prog) { unsigned int i; @@ -208,16 +325,29 @@ void brw_debug_batch(struct intel_context *intel) state_struct_out("WM bind", brw->wm.bind_bo, 4 * brw->wm.nr_surfaces); dump_wm_surface_state(brw); - state_struct_out("VS", brw->vs.state_bo, sizeof(struct brw_vs_unit_state)); + if (intel->gen < 6) + state_struct_out("VS", brw->vs.state_bo, sizeof(struct brw_vs_unit_state)); brw_debug_prog("VS prog", brw->vs.prog_bo); - state_struct_out("GS", brw->gs.state_bo, sizeof(struct brw_gs_unit_state)); + if (intel->gen < 6) + state_struct_out("GS", brw->gs.state_bo, sizeof(struct brw_gs_unit_state)); brw_debug_prog("GS prog", brw->gs.prog_bo); - state_struct_out("SF", brw->sf.state_bo, sizeof(struct brw_sf_unit_state)); + if (intel->gen < 6) { + state_struct_out("SF", brw->sf.state_bo, sizeof(struct brw_sf_unit_state)); + brw_debug_prog("SF prog", brw->sf.prog_bo); + } dump_sf_viewport_state(brw); - brw_debug_prog("SF prog", brw->sf.prog_bo); - state_struct_out("WM", brw->wm.state_bo, sizeof(struct brw_wm_unit_state)); + if (intel->gen < 6) + state_struct_out("WM", brw->wm.state_bo, sizeof(struct brw_wm_unit_state)); brw_debug_prog("WM prog", brw->wm.prog_bo); + + if (intel->gen >= 6) { + dump_cc_viewport_state(brw); + dump_clip_viewport_state(brw); + dump_depth_stencil_state(brw); + dump_cc_state(brw); + dump_blend_state(brw); + } } diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index a0c130557e..73940a5156 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -145,6 +145,7 @@ const struct brw_tracked_state *gen6_atoms[] = &gen6_wm_state, &gen6_scissor_state, + &gen6_scissor_state_pointers, &brw_state_base_address, @@ -231,7 +232,6 @@ static struct dirty_bit_map mesa_bits[] = { DEFINE_BIT(_NEW_MODELVIEW), DEFINE_BIT(_NEW_PROJECTION), DEFINE_BIT(_NEW_TEXTURE_MATRIX), - DEFINE_BIT(_NEW_COLOR_MATRIX), DEFINE_BIT(_NEW_ACCUM), DEFINE_BIT(_NEW_COLOR), DEFINE_BIT(_NEW_DEPTH), @@ -336,7 +336,7 @@ brw_print_dirty_count(struct dirty_bit_map *bit_map, int32_t bits) */ void brw_validate_state( struct brw_context *brw ) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct intel_context *intel = &brw->intel; struct brw_state_flags *state = &brw->state.dirty; GLuint i; diff --git a/src/mesa/drivers/dri/i965/brw_structs.h b/src/mesa/drivers/dri/i965/brw_structs.h index 2a118e01c5..8ce9af9c4f 100644 --- a/src/mesa/drivers/dri/i965/brw_structs.h +++ b/src/mesa/drivers/dri/i965/brw_structs.h @@ -909,10 +909,12 @@ struct brw_sf_unit_state }; -struct gen6_scissor_state +struct gen6_scissor_rect { - GLuint ymin, xmin; - GLuint ymax, xmax; + GLuint xmin:16; + GLuint ymin:16; + GLuint xmax:16; + GLuint ymax:16; }; struct brw_gs_unit_state @@ -1073,7 +1075,7 @@ struct brw_sampler_state GLuint mag_filter:3; GLuint mip_filter:2; GLuint base_level:5; - GLuint pad:1; + GLuint min_mag_neq:1; GLuint lod_preclamp:1; GLuint default_color_mode:1; GLuint pad0:1; @@ -1085,7 +1087,8 @@ struct brw_sampler_state GLuint r_wrap_mode:3; GLuint t_wrap_mode:3; GLuint s_wrap_mode:3; - GLuint pad:3; + GLuint cube_control_mode:1; + GLuint pad:2; GLuint max_lod:10; GLuint min_lod:10; } ss1; @@ -1099,7 +1102,9 @@ struct brw_sampler_state struct { - GLuint pad:19; + GLuint non_normalized_coord:1; + GLuint pad:12; + GLuint address_round:6; GLuint max_aniso:3; GLuint chroma_key_mode:1; GLuint chroma_key_index:2; @@ -1210,10 +1215,9 @@ struct brw_surface_state struct { GLuint pad1:16; - GLuint llc_mapping:1; - GLuint mlc_mapping:1; + GLuint cache_control:2; GLuint gfdt:1; - GLuint gfdt_src:1; + GLuint encrypt:1; GLuint y_offset:4; GLuint pad0:1; GLuint x_offset:7; @@ -1377,6 +1381,18 @@ struct brw_instruction GLuint dest_horiz_stride:2; GLuint dest_address_mode:1; } ia16; + + struct { + GLuint dest_reg_file:2; + GLuint dest_reg_type:3; + GLuint src0_reg_file:2; + GLuint src0_reg_type:3; + GLuint src1_reg_file:2; + GLuint src1_reg_type:3; + GLuint pad:1; + + GLint jump_count:16; + } branch_gen6; } bits1; diff --git a/src/mesa/drivers/dri/i965/brw_tex.c b/src/mesa/drivers/dri/i965/brw_tex.c index e911b105b2..39dfd34f4c 100644 --- a/src/mesa/drivers/dri/i965/brw_tex.c +++ b/src/mesa/drivers/dri/i965/brw_tex.c @@ -45,7 +45,7 @@ */ void brw_validate_textures( struct brw_context *brw ) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct intel_context *intel = &brw->intel; int i; diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c index 768ccfd79c..9ac0713a1d 100644 --- a/src/mesa/drivers/dri/i965/brw_tex_layout.c +++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c @@ -48,7 +48,7 @@ GLboolean brw_miptree_layout(struct intel_context *intel, switch (mt->target) { case GL_TEXTURE_CUBE_MAP: - if (intel->gen == 5) { + if (intel->gen >= 5) { GLuint align_h = 2; GLuint level; GLuint qpitch = 0; diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index 9f90e1e5e5..4a41c7a517 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -43,7 +43,7 @@ static void do_vs_prog( struct brw_context *brw, struct brw_vertex_program *vp, struct brw_vs_prog_key *key ) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; GLuint program_size; const GLuint *program; struct brw_vs_compile c; @@ -96,6 +96,7 @@ static void do_vs_prog( struct brw_context *brw, sizeof(c.prog_data)); assert(ctx->Const.VertexProgram.MaxNativeParameters == ARRAY_SIZE(c.constant_map)); + (void) ctx; aux_size = sizeof(c.prog_data); if (c.vp->use_const_buffer) @@ -114,7 +115,7 @@ static void do_vs_prog( struct brw_context *brw, static void brw_upload_vs_prog(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct brw_vs_prog_key key; struct brw_vertex_program *vp = (struct brw_vertex_program *)brw->vertex_program; diff --git a/src/mesa/drivers/dri/i965/brw_vs_constval.c b/src/mesa/drivers/dri/i965/brw_vs_constval.c index 249a800bf4..47cc0a7da7 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_constval.c +++ b/src/mesa/drivers/dri/i965/brw_vs_constval.c @@ -190,7 +190,7 @@ static GLuint get_input_size(struct brw_context *brw, */ static void calc_wm_input_sizes( struct brw_context *brw ) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; /* BRW_NEW_VERTEX_PROGRAM */ const struct brw_vertex_program *vp = brw_vertex_program_const(brw->vertex_program); diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index ad0d00b87c..e2bff1386b 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -254,7 +254,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) c->first_overflow_output = 0; if (intel->gen >= 6) - mrf = 4; + mrf = 3; /* no more pos store in attribute */ else if (intel->gen == 5) mrf = 8; else @@ -593,11 +593,15 @@ static void emit_math1( struct brw_vs_compile *c, struct brw_compile *p = &c->func; struct intel_context *intel = &p->brw->intel; struct brw_reg tmp = dst; - GLboolean need_tmp = (intel->gen < 6 && - (dst.dw1.bits.writemask != 0xf || - dst.file != BRW_GENERAL_REGISTER_FILE)); + GLboolean need_tmp = GL_FALSE; - if (need_tmp) + if (dst.file != BRW_GENERAL_REGISTER_FILE) + need_tmp = GL_TRUE; + + if (intel->gen < 6 && dst.dw1.bits.writemask != 0xf) + need_tmp = GL_TRUE; + + if (need_tmp) tmp = get_tmp(c); brw_math(p, @@ -626,9 +630,13 @@ static void emit_math2( struct brw_vs_compile *c, struct brw_compile *p = &c->func; struct intel_context *intel = &p->brw->intel; struct brw_reg tmp = dst; - GLboolean need_tmp = (intel->gen < 6 && - (dst.dw1.bits.writemask != 0xf || - dst.file != BRW_GENERAL_REGISTER_FILE)); + GLboolean need_tmp = GL_FALSE; + + if (dst.file != BRW_GENERAL_REGISTER_FILE) + need_tmp = GL_TRUE; + + if (intel->gen < 6 && dst.dw1.bits.writemask != 0xf) + need_tmp = GL_TRUE; if (need_tmp) tmp = get_tmp(c); @@ -1392,8 +1400,11 @@ static void emit_vertex_write( struct brw_vs_compile *c) if (c->prog_data.outputs_written & BITFIELD64_BIT(VERT_RESULT_PSIZ)) { struct brw_reg psiz = c->regs[PROGRAM_OUTPUT][VERT_RESULT_PSIZ]; - brw_MUL(p, brw_writemask(header1, WRITEMASK_W), brw_swizzle1(psiz, 0), brw_imm_f(1<<11)); - brw_AND(p, brw_writemask(header1, WRITEMASK_W), header1, brw_imm_ud(0x7ff<<8)); + if (intel->gen < 6) { + brw_MUL(p, brw_writemask(header1, WRITEMASK_W), brw_swizzle1(psiz, 0), brw_imm_f(1<<11)); + brw_AND(p, brw_writemask(header1, WRITEMASK_W), header1, brw_imm_ud(0x7ff<<8)); + } else + brw_MOV(p, brw_writemask(header1, WRITEMASK_W), brw_swizzle1(psiz, 0)); } for (i = 0; i < c->key.nr_userclip; i++) { @@ -1451,8 +1462,7 @@ static void emit_vertex_write( struct brw_vs_compile *c) * position. */ brw_MOV(p, brw_message_reg(2), pos); - brw_MOV(p, brw_message_reg(3), pos); - len_vertex_header = 2; + len_vertex_header = 1; } else if (intel->gen == 5) { /* There are 20 DWs (D0-D19) in VUE header on Ironlake: * dword 0-3 (m1) of the header is indices, point width, clip flags. @@ -1633,6 +1643,10 @@ void brw_vs_emit(struct brw_vs_compile *c ) printf("\n"); } + /* FIXME Need to fix conditional instruction to remove this */ + if (intel->gen >= 6) + p->single_program_flow = GL_TRUE; + brw_set_compression_control(p, BRW_COMPRESSION_NONE); brw_set_access_mode(p, BRW_ALIGN_16); if_depth_in_loop[loop_depth] = 0; diff --git a/src/mesa/drivers/dri/i965/brw_vs_state.c b/src/mesa/drivers/dri/i965/brw_vs_state.c index 9b2dd5b3d1..ebae94269f 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_state.c +++ b/src/mesa/drivers/dri/i965/brw_vs_state.c @@ -51,7 +51,7 @@ struct brw_vs_unit_key { static void vs_unit_populate_key(struct brw_context *brw, struct brw_vs_unit_key *key) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; memset(key, 0, sizeof(*key)); diff --git a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c index 0250a68d29..eabac51160 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c @@ -45,7 +45,7 @@ static void prepare_vs_constants(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct intel_context *intel = &brw->intel; struct brw_vertex_program *vp = (struct brw_vertex_program *) brw->vertex_program; @@ -101,7 +101,7 @@ const struct brw_tracked_state brw_vs_constants = { * Sets brw->vs.surf_bo[surf] and brw->vp->const_buffer. */ static void -brw_update_vs_constant_surface( GLcontext *ctx, +brw_update_vs_constant_surface( struct gl_context *ctx, GLuint surf) { struct brw_context *brw = brw_context(ctx); @@ -151,7 +151,7 @@ prepare_vs_surfaces(struct brw_context *brw) */ static void upload_vs_surfaces(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; uint32_t *bind; int i; diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c index 8f1601d10f..3d7a98c981 100644 --- a/src/mesa/drivers/dri/i965/brw_vtbl.c +++ b/src/mesa/drivers/dri/i965/brw_vtbl.c @@ -43,7 +43,6 @@ #include "brw_defines.h" #include "brw_state.h" #include "brw_draw.h" -#include "brw_state.h" #include "brw_vs.h" #include "brw_wm.h" diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index d70be7bda2..7aad6caf71 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -215,7 +215,8 @@ static void do_wm_prog( struct brw_context *brw, static void brw_wm_populate_key( struct brw_context *brw, struct brw_wm_prog_key *key ) { - GLcontext *ctx = &brw->intel.ctx; + struct intel_context *intel = &brw->intel; + struct gl_context *ctx = &brw->intel.ctx; /* BRW_NEW_FRAGMENT_PROGRAM */ const struct brw_fragment_program *fp = (struct brw_fragment_program *)brw->fragment_program; @@ -278,12 +279,52 @@ static void brw_wm_populate_key( struct brw_context *brw, } } } - - brw_wm_lookup_iz(line_aa, - lookup, - uses_depth, - key); + if (intel->gen >= 6) { + /* R0-1: masks, pixel X/Y coordinates. */ + key->nr_payload_regs = 2; + /* R2: only for 32-pixel dispatch.*/ + /* R3-4: perspective pixel location barycentric */ + key->nr_payload_regs += 2; + /* R5-6: perspective pixel location bary for dispatch width != 8 */ + if (!fp->isGLSL) { /* dispatch_width != 8 */ + key->nr_payload_regs += 2; + } + /* R7-10: perspective centroid barycentric */ + /* R11-14: perspective sample barycentric */ + /* R15-18: linear pixel location barycentric */ + /* R19-22: linear centroid barycentric */ + /* R23-26: linear sample barycentric */ + + /* R27: interpolated depth if uses source depth */ + if (uses_depth) { + key->source_depth_reg = key->nr_payload_regs; + key->nr_payload_regs++; + if (!fp->isGLSL) { /* dispatch_width != 8 */ + /* R28: interpolated depth if not 8-wide. */ + key->nr_payload_regs++; + } + } + /* R29: interpolated W set if GEN6_WM_USES_SOURCE_W. + */ + if (uses_depth) { + key->source_w_reg = key->nr_payload_regs; + key->nr_payload_regs++; + if (!fp->isGLSL) { /* dispatch_width != 8 */ + /* R30: interpolated W if not 8-wide. */ + key->nr_payload_regs++; + } + } + /* R31: MSAA position offsets. */ + /* R32-: bary for 32-pixel. */ + /* R58-59: interp W for 32-pixel. */ + } else { + brw_wm_lookup_iz(intel, + line_aa, + lookup, + uses_depth, + key); + } /* BRW_NEW_WM_INPUT_DIMENSIONS */ key->proj_attrib_mask = brw->wm.input_size_masks[4-1]; @@ -301,13 +342,44 @@ static void brw_wm_populate_key( struct brw_context *brw, if (unit->_ReallyEnabled) { const struct gl_texture_object *t = unit->_Current; const struct gl_texture_image *img = t->Image[0][t->BaseLevel]; + int swizzles[SWIZZLE_NIL + 1] = { + SWIZZLE_X, + SWIZZLE_Y, + SWIZZLE_Z, + SWIZZLE_W, + SWIZZLE_ZERO, + SWIZZLE_ONE, + SWIZZLE_NIL + }; + + key->tex_swizzles[i] = SWIZZLE_NOOP; + + /* GL_DEPTH_TEXTURE_MODE is normally handled through + * brw_wm_surface_state, but it applies to shadow compares as + * well and our shadow compares always return the result in + * all 4 channels. + */ + if (t->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) { + if (t->DepthMode == GL_ALPHA) { + swizzles[0] = SWIZZLE_ZERO; + swizzles[1] = SWIZZLE_ZERO; + swizzles[2] = SWIZZLE_ZERO; + } else if (t->DepthMode == GL_LUMINANCE) { + swizzles[3] = SWIZZLE_ONE; + } + } + if (img->InternalFormat == GL_YCBCR_MESA) { key->yuvtex_mask |= 1 << i; if (img->TexFormat == MESA_FORMAT_YCBCR) key->yuvtex_swap_mask |= 1 << i; } - key->tex_swizzles[i] = t->_Swizzle; + key->tex_swizzles[i] = + MAKE_SWIZZLE4(swizzles[GET_SWZ(t->_Swizzle, 0)], + swizzles[GET_SWZ(t->_Swizzle, 1)], + swizzles[GET_SWZ(t->_Swizzle, 2)], + swizzles[GET_SWZ(t->_Swizzle, 3)]); } else { key->tex_swizzles[i] = SWIZZLE_NOOP; diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 2639d4f26b..a094c45a7e 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -59,6 +59,7 @@ struct brw_wm_prog_key { GLuint source_depth_reg:3; + GLuint source_w_reg:3; GLuint aa_dest_stencil_reg:3; GLuint dest_depth_reg:3; GLuint nr_payload_regs:4; @@ -181,7 +182,11 @@ struct brw_wm_instruction { #define MAX_WM_OPCODE (MAX_OPCODE + 9) #define PROGRAM_PAYLOAD (PROGRAM_FILE_MAX) +#define NUM_FILES (PROGRAM_PAYLOAD + 1) + #define PAYLOAD_DEPTH (FRAG_ATTRIB_MAX) +#define PAYLOAD_W (FRAG_ATTRIB_MAX + 1) +#define PAYLOAD_FP_REG_MAX (FRAG_ATTRIB_MAX + 2) struct brw_wm_compile { struct brw_compile func; @@ -224,7 +229,7 @@ struct brw_wm_compile { } payload; - const struct brw_wm_ref *pass0_fp_reg[PROGRAM_PAYLOAD+1][256][4]; + const struct brw_wm_ref *pass0_fp_reg[NUM_FILES][256][4]; struct brw_wm_ref undef_ref; struct brw_wm_value undef_value; @@ -252,7 +257,7 @@ struct brw_wm_compile { struct { GLboolean inited; struct brw_reg reg; - } wm_regs[PROGRAM_PAYLOAD+1][256][4]; + } wm_regs[NUM_FILES][256][4]; GLboolean used_grf[BRW_WM_MAX_GRF]; GLuint first_free_grf; @@ -299,7 +304,8 @@ void brw_wm_print_insn( struct brw_wm_compile *c, void brw_wm_print_program( struct brw_wm_compile *c, const char *stage ); -void brw_wm_lookup_iz( GLuint line_aa, +void brw_wm_lookup_iz( struct intel_context *intel, + GLuint line_aa, GLuint lookup, GLboolean ps_uses_depth, struct brw_wm_prog_key *key ); @@ -373,6 +379,7 @@ void emit_fb_write(struct brw_wm_compile *c, void emit_frontfacing(struct brw_compile *p, const struct brw_reg *dst, GLuint mask); +void emit_kil_nv(struct brw_wm_compile *c); void emit_linterp(struct brw_compile *p, const struct brw_reg *dst, GLuint mask, @@ -460,13 +467,10 @@ void emit_xpd(struct brw_compile *p, const struct brw_reg *arg0, const struct brw_reg *arg1); -GLboolean brw_compile_shader(GLcontext *ctx, +GLboolean brw_compile_shader(struct gl_context *ctx, struct gl_shader *shader); -GLboolean brw_link_shader(GLcontext *ctx, struct gl_shader_program *prog); -struct gl_shader *brw_new_shader(GLcontext *ctx, GLuint name, GLuint type); -struct gl_shader_program *brw_new_shader_program(GLcontext *ctx, GLuint name); - -GLboolean brw_do_channel_expressions(struct exec_list *instructions); -GLboolean brw_do_vector_splitting(struct exec_list *instructions); +GLboolean brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog); +struct gl_shader *brw_new_shader(struct gl_context *ctx, GLuint name, GLuint type); +struct gl_shader_program *brw_new_shader_program(struct gl_context *ctx, GLuint name); #endif diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index f3ad01b3fe..cb71c665b4 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -173,6 +173,7 @@ void emit_delta_xy(struct brw_compile *p, GLuint mask, const struct brw_reg *arg0) { + struct intel_context *intel = &p->brw->intel; struct brw_reg r1 = brw_vec1_grf(1, 0); if (mask == 0) @@ -180,6 +181,21 @@ void emit_delta_xy(struct brw_compile *p, assert(mask == WRITEMASK_XY); + if (intel->gen >= 6) { + /* XXX Gen6 WM doesn't have Xstart/Ystart in payload r1.0/r1.1. + Just add them with 0.0 for dst reg.. */ + r1 = brw_imm_v(0x00000000); + brw_ADD(p, + dst[0], + retype(arg0[0], BRW_REGISTER_TYPE_UW), + r1); + brw_ADD(p, + dst[1], + retype(arg0[1], BRW_REGISTER_TYPE_UW), + r1); + return; + } + /* Calc delta X,Y by subtracting origin in r1 from the pixel * centers produced by emit_pixel_xy(). */ @@ -253,6 +269,15 @@ void emit_pixel_w(struct brw_wm_compile *c, { struct brw_compile *p = &c->func; struct intel_context *intel = &p->brw->intel; + struct brw_reg src; + struct brw_reg temp_dst; + + if (intel->gen >= 6) + temp_dst = dst[3]; + else + temp_dst = brw_message_reg(2); + + assert(intel->gen < 6); /* Don't need this if all you are doing is interpolating color, for * instance. @@ -264,31 +289,35 @@ void emit_pixel_w(struct brw_wm_compile *c, * result straight into a message reg. */ if (can_do_pln(intel, deltas)) { - brw_PLN(p, brw_message_reg(2), interp3, deltas[0]); + brw_PLN(p, temp_dst, interp3, deltas[0]); } else { brw_LINE(p, brw_null_reg(), interp3, deltas[0]); - brw_MAC(p, brw_message_reg(2), suboffset(interp3, 1), deltas[1]); + brw_MAC(p, temp_dst, suboffset(interp3, 1), deltas[1]); } /* Calc w */ + if (intel->gen >= 6) + src = temp_dst; + else + src = brw_null_reg(); + if (c->dispatch_width == 16) { brw_math_16(p, dst[3], BRW_MATH_FUNCTION_INV, BRW_MATH_SATURATE_NONE, - 2, brw_null_reg(), + 2, src, BRW_MATH_PRECISION_FULL); } else { brw_math(p, dst[3], BRW_MATH_FUNCTION_INV, BRW_MATH_SATURATE_NONE, - 2, brw_null_reg(), + 2, src, BRW_MATH_DATA_VECTOR, BRW_MATH_PRECISION_FULL); } } } - void emit_linterp(struct brw_compile *p, const struct brw_reg *dst, GLuint mask, @@ -307,7 +336,9 @@ void emit_linterp(struct brw_compile *p, for (i = 0; i < 4; i++) { if (mask & (1<<i)) { - if (can_do_pln(intel, deltas)) { + if (intel->gen >= 6) { + brw_PLN(p, dst[i], interp[i], brw_vec8_grf(2, 0)); + } else if (can_do_pln(intel, deltas)) { brw_PLN(p, dst[i], interp[i], deltas[0]); } else { brw_LINE(p, brw_null_reg(), interp[i], deltas[0]); @@ -330,6 +361,11 @@ void emit_pinterp(struct brw_compile *p, GLuint nr = arg0[0].nr; GLuint i; + if (intel->gen >= 6) { + emit_linterp(p, dst, mask, arg0, interp); + return; + } + interp[0] = brw_vec1_grf(nr, 0); interp[1] = brw_vec1_grf(nr, 4); interp[2] = brw_vec1_grf(nr+1, 0); @@ -910,10 +946,8 @@ void emit_math2(struct brw_wm_compile *c, const struct brw_reg *arg1) { struct brw_compile *p = &c->func; + struct intel_context *intel = &p->brw->intel; int dst_chan = _mesa_ffs(mask & WRITEMASK_XYZW) - 1; - GLuint saturate = ((mask & SATURATE) ? - BRW_MATH_SATURATE_SATURATE : - BRW_MATH_SATURATE_NONE); if (!(mask & WRITEMASK_XYZW)) return; /* Do not emit dead code */ @@ -922,35 +956,103 @@ void emit_math2(struct brw_wm_compile *c, brw_push_insn_state(p); - brw_set_compression_control(p, BRW_COMPRESSION_NONE); - brw_MOV(p, brw_message_reg(3), arg1[0]); - if (c->dispatch_width == 16) { - brw_set_compression_control(p, BRW_COMPRESSION_2NDHALF); - brw_MOV(p, brw_message_reg(5), sechalf(arg1[0])); - } + /* math can only operate on up to a vec8 at a time, so in + * dispatch_width==16 we have to do the second half manually. + */ + if (intel->gen >= 6) { + struct brw_reg src0 = arg0[0]; + struct brw_reg src1 = arg1[0]; + struct brw_reg temp_dst = dst[dst_chan]; + + if (arg0[0].hstride == BRW_HORIZONTAL_STRIDE_0) { + if (arg1[0].hstride == BRW_HORIZONTAL_STRIDE_0) { + /* Both scalar arguments. Do scalar calc. */ + src0.hstride = BRW_HORIZONTAL_STRIDE_1; + src1.hstride = BRW_HORIZONTAL_STRIDE_1; + temp_dst.hstride = BRW_HORIZONTAL_STRIDE_1; + temp_dst.width = BRW_WIDTH_1; + + if (arg0[0].subnr != 0) { + brw_MOV(p, temp_dst, src0); + src0 = temp_dst; + + /* Ouch. We've used the temp as a dst, and we still + * need a temp to store arg1 in, because src and dst + * offsets have to be equal. Leaving this up to + * glsl2-965 to handle correctly. + */ + assert(arg1[0].subnr == 0); + } else if (arg1[0].subnr != 0) { + brw_MOV(p, temp_dst, src1); + src1 = temp_dst; + } + } else { + brw_MOV(p, temp_dst, src0); + src0 = temp_dst; + } + } else if (arg1[0].hstride == BRW_HORIZONTAL_STRIDE_0) { + brw_MOV(p, temp_dst, src1); + src1 = temp_dst; + } - brw_set_compression_control(p, BRW_COMPRESSION_NONE); - brw_math(p, - dst[dst_chan], - function, - saturate, - 2, - arg0[0], - BRW_MATH_DATA_VECTOR, - BRW_MATH_PRECISION_FULL); + brw_set_saturate(p, (mask & SATURATE) ? 1 : 0); + brw_set_compression_control(p, BRW_COMPRESSION_NONE); + brw_math2(p, + temp_dst, + function, + src0, + src1); + if (c->dispatch_width == 16) { + brw_set_compression_control(p, BRW_COMPRESSION_2NDHALF); + brw_math2(p, + sechalf(temp_dst), + function, + sechalf(src0), + sechalf(src1)); + } - /* Send two messages to perform all 16 operations: - */ - if (c->dispatch_width == 16) { - brw_set_compression_control(p, BRW_COMPRESSION_2NDHALF); + /* Splat a scalar result into all the channels. */ + if (arg0[0].hstride == BRW_HORIZONTAL_STRIDE_0 && + arg1[0].hstride == BRW_HORIZONTAL_STRIDE_0) { + temp_dst.hstride = BRW_HORIZONTAL_STRIDE_0; + temp_dst.vstride = BRW_VERTICAL_STRIDE_0; + brw_MOV(p, dst[dst_chan], temp_dst); + } + } else { + GLuint saturate = ((mask & SATURATE) ? + BRW_MATH_SATURATE_SATURATE : + BRW_MATH_SATURATE_NONE); + + brw_set_compression_control(p, BRW_COMPRESSION_NONE); + brw_MOV(p, brw_message_reg(3), arg1[0]); + if (c->dispatch_width == 16) { + brw_set_compression_control(p, BRW_COMPRESSION_2NDHALF); + brw_MOV(p, brw_message_reg(5), sechalf(arg1[0])); + } + + brw_set_compression_control(p, BRW_COMPRESSION_NONE); brw_math(p, - offset(dst[dst_chan],1), + dst[dst_chan], function, saturate, - 4, - sechalf(arg0[0]), + 2, + arg0[0], BRW_MATH_DATA_VECTOR, BRW_MATH_PRECISION_FULL); + + /* Send two messages to perform all 16 operations: + */ + if (c->dispatch_width == 16) { + brw_set_compression_control(p, BRW_COMPRESSION_2NDHALF); + brw_math(p, + offset(dst[dst_chan],1), + function, + saturate, + 4, + sechalf(arg0[0]), + BRW_MATH_DATA_VECTOR, + BRW_MATH_PRECISION_FULL); + } } brw_pop_insn_state(p); } @@ -1028,7 +1130,7 @@ void emit_tex(struct brw_wm_compile *c, /* Fill in the shadow comparison reference value. */ if (shadow) { - if (intel->gen == 5) { + if (intel->gen >= 5) { /* Fill in the cube map array index value. */ brw_MOV(p, brw_message_reg(cur_mrf), brw_imm_f(0)); cur_mrf += mrf_per_channel; @@ -1041,7 +1143,7 @@ void emit_tex(struct brw_wm_compile *c, cur_mrf += mrf_per_channel; } - if (intel->gen == 5) { + if (intel->gen >= 5) { if (shadow) msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_COMPARE_GEN5; else @@ -1094,7 +1196,7 @@ void emit_txb(struct brw_wm_compile *c, * from mattering. */ if (c->dispatch_width == 16 || intel->gen < 5) { - if (intel->gen == 5) + if (intel->gen >= 5) msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_GEN5; else msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS; @@ -1223,7 +1325,7 @@ static void emit_kil( struct brw_wm_compile *c, /* KIL_NV kills the pixels that are currently executing, not based on a test * of the arguments. */ -static void emit_kil_nv( struct brw_wm_compile *c ) +void emit_kil_nv( struct brw_wm_compile *c ) { struct brw_compile *p = &c->func; struct brw_reg r0uw = retype(brw_vec1_grf(0, 0), BRW_REGISTER_TYPE_UW); @@ -1553,9 +1655,12 @@ static void spill_values( struct brw_wm_compile *c, void brw_wm_emit( struct brw_wm_compile *c ) { struct brw_compile *p = &c->func; + struct intel_context *intel = &p->brw->intel; GLuint insn; brw_set_compression_control(p, BRW_COMPRESSION_COMPRESSED); + if (intel->gen >= 6) + brw_set_acc_write_control(p, 1); /* Check if any of the payload regs need to be spilled: */ @@ -1667,7 +1772,11 @@ void brw_wm_emit( struct brw_wm_compile *c ) break; case OPCODE_TRUNC: - emit_alu1(p, brw_RNDZ, dst, dst_flags, args[0]); + for (i = 0; i < 4; i++) { + if (dst_flags & (1<<i)) { + brw_RNDZ(p, dst[i], args[0][i]); + } + } break; case OPCODE_LRP: diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index 3870bf10fc..15a238cda6 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -89,6 +89,8 @@ static struct prog_src_register src_reg(GLuint file, GLuint idx) reg.Negate = NEGATE_NONE; reg.Abs = 0; reg.HasIndex2 = 0; + reg.RelAddr2 = 0; + reg.Index2 = 0; return reg; } @@ -336,6 +338,12 @@ static struct prog_src_register get_delta_xy( struct brw_wm_compile *c ) static struct prog_src_register get_pixel_w( struct brw_wm_compile *c ) { + /* This is only called for producing 1/w in pre-gen6 interp. for + * gen6, the interp opcodes don't use this argument. + */ + if (c->func.brw->intel.gen >= 6) + return src_undef(); + if (src_is_undef(c->pixel_w)) { struct prog_dst_register pixel_w = get_temp(c); struct prog_src_register deltas = get_delta_xy(c); @@ -363,7 +371,13 @@ static void emit_interp( struct brw_wm_compile *c, { struct prog_dst_register dst = dst_reg(PROGRAM_INPUT, idx); struct prog_src_register interp = src_reg(PROGRAM_PAYLOAD, idx); - struct prog_src_register deltas = get_delta_xy(c); + struct prog_src_register deltas; + + if (c->func.brw->intel.gen < 6) { + deltas = get_delta_xy(c); + } else { + deltas = src_undef(); + } /* Need to use PINTERP on attributes which have been * multiplied by 1/W in the SF program, and LINTERP on those @@ -520,12 +534,6 @@ static struct prog_src_register search_or_add_param5(struct brw_wm_compile *c, tokens[2] = s2; tokens[3] = s3; tokens[4] = s4; - - for (idx = 0; idx < paramList->NumParameters; idx++) { - if (paramList->Parameters[idx].Type == PROGRAM_STATE_VAR && - memcmp(paramList->Parameters[idx].StateIndexes, tokens, sizeof(tokens)) == 0) - return src_reg(PROGRAM_STATE_VAR, idx); - } idx = _mesa_add_state_reference( paramList, tokens ); @@ -543,28 +551,18 @@ static struct prog_src_register search_or_add_const4f( struct brw_wm_compile *c, GLfloat values[4]; GLuint idx; GLuint swizzle; + struct prog_src_register reg; values[0] = s0; values[1] = s1; values[2] = s2; values[3] = s3; - /* Have to search, otherwise multiple compilations will each grow - * the parameter list. - */ - for (idx = 0; idx < paramList->NumParameters; idx++) { - if (paramList->Parameters[idx].Type == PROGRAM_CONSTANT && - memcmp(paramList->ParameterValues[idx], values, sizeof(values)) == 0) - - /* XXX: this mimics the mesa bug which puts all constants and - * parameters into the "PROGRAM_STATE_VAR" category: - */ - return src_reg(PROGRAM_STATE_VAR, idx); - } - idx = _mesa_add_unnamed_constant( paramList, values, 4, &swizzle ); - assert(swizzle == SWIZZLE_NOOP); /* Need to handle swizzle in reg setup */ - return src_reg(PROGRAM_STATE_VAR, idx); + reg = src_reg(PROGRAM_STATE_VAR, idx); + reg.Swizzle = swizzle; + + return reg; } @@ -1056,6 +1054,7 @@ static void print_insns( const struct prog_instruction *insn, */ void brw_wm_pass_fp( struct brw_wm_compile *c ) { + struct intel_context *intel = &c->func.brw->intel; struct brw_fragment_program *fp = c->fp; GLuint insn; @@ -1067,7 +1066,14 @@ void brw_wm_pass_fp( struct brw_wm_compile *c ) } c->pixel_xy = src_undef(); - c->delta_xy = src_undef(); + if (intel->gen >= 6) { + /* The interpolation deltas come in as the perspective pixel + * location barycentric params. + */ + c->delta_xy = src_reg(PROGRAM_PAYLOAD, PAYLOAD_DEPTH); + } else { + c->delta_xy = src_undef(); + } c->pixel_w = src_undef(); c->nr_fp_insns = 0; c->fp->tex_units_used = 0x0; diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 7d6724dc1c..55aceea9b5 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -296,6 +296,8 @@ static void prealloc_reg(struct brw_wm_compile *c) reg = brw_vec8_grf(0, 0); set_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, i, reg); } + set_reg(c, PROGRAM_PAYLOAD, PAYLOAD_W, 0, + brw_vec8_grf(c->key.source_w_reg, 0)); reg_index += c->key.nr_payload_regs; /* constants */ @@ -340,31 +342,47 @@ static void prealloc_reg(struct brw_wm_compile *c) } } /* number of constant regs used (each reg is float[8]) */ - c->nr_creg = 2 * ((4 * nr_params + 15) / 16); - reg_index += c->nr_creg; + c->nr_creg = ALIGN(nr_params, 2) / 2; + reg_index += c->nr_creg; } } - /* fragment shader inputs */ - for (i = 0; i < VERT_RESULT_MAX; i++) { - int fp_input; - - if (i >= VERT_RESULT_VAR0) - fp_input = i - VERT_RESULT_VAR0 + FRAG_ATTRIB_VAR0; - else if (i <= VERT_RESULT_TEX7) - fp_input = i; - else - fp_input = -1; + /* fragment shader inputs: One 2-reg pair of interpolation + * coefficients for each vec4 to be set up. + */ + if (intel->gen >= 6) { + for (i = 0; i < FRAG_ATTRIB_MAX; i++) { + if (!(c->fp->program.Base.InputsRead & BITFIELD64_BIT(i))) + continue; - if (fp_input >= 0 && inputs & (1 << fp_input)) { - urb_read_length = reg_index; reg = brw_vec8_grf(reg_index, 0); - for (j = 0; j < 4; j++) - set_reg(c, PROGRAM_PAYLOAD, fp_input, j, reg); - } - if (c->key.vp_outputs_written & BITFIELD64_BIT(i)) { + for (j = 0; j < 4; j++) { + set_reg(c, PROGRAM_PAYLOAD, i, j, reg); + } reg_index += 2; } + urb_read_length = reg_index; + } else { + for (i = 0; i < VERT_RESULT_MAX; i++) { + int fp_input; + + if (i >= VERT_RESULT_VAR0) + fp_input = i - VERT_RESULT_VAR0 + FRAG_ATTRIB_VAR0; + else if (i <= VERT_RESULT_TEX7) + fp_input = i; + else + fp_input = -1; + + if (fp_input >= 0 && inputs & (1 << fp_input)) { + urb_read_length = reg_index; + reg = brw_vec8_grf(reg_index, 0); + for (j = 0; j < 4; j++) + set_reg(c, PROGRAM_PAYLOAD, fp_input, j, reg); + } + if (c->key.vp_outputs_written & BITFIELD64_BIT(i)) { + reg_index += 2; + } + } } c->prog_data.first_curbe_grf = c->key.nr_payload_regs; @@ -614,21 +632,6 @@ static void emit_arl(struct brw_wm_compile *c, brw_set_saturate(p, 0); } -/** - * For GLSL shaders, this KIL will be unconditional. - * It may be contained inside an IF/ENDIF structure of course. - */ -static void emit_kil(struct brw_wm_compile *c) -{ - struct brw_compile *p = &c->func; - struct brw_reg depth = retype(brw_vec1_grf(0, 0), BRW_REGISTER_TYPE_UW); - brw_push_insn_state(p); - brw_set_mask_control(p, BRW_MASK_DISABLE); - brw_NOT(p, c->emit_mask_reg, brw_mask_reg(1)); /* IMASK */ - brw_AND(p, depth, c->emit_mask_reg, depth); - brw_pop_insn_state(p); -} - static INLINE struct brw_reg high_words( struct brw_reg reg ) { return stride( suboffset( retype( reg, BRW_REGISTER_TYPE_W ), 1 ), @@ -708,6 +711,9 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) brw_set_compression_control(p, BRW_COMPRESSION_NONE); brw_MOV(p, get_addr_reg(stack_index), brw_address(c->stack)); + if (intel->gen >= 6) + brw_set_acc_write_control(p, 1); + for (i = 0; i < c->nr_fp_insns; i++) { const struct prog_instruction *inst = &c->prog_instructions[i]; int dst_flags; @@ -898,7 +904,7 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) c->fp->program.Base.SamplerUnits[inst->TexSrcUnit]); break; case OPCODE_KIL_NV: - emit_kil(c); + emit_kil_nv(c); break; case OPCODE_IF: assert(if_depth < MAX_IF_DEPTH); diff --git a/src/mesa/drivers/dri/i965/brw_wm_iz.c b/src/mesa/drivers/dri/i965/brw_wm_iz.c index 8505ef1951..62e556698b 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_iz.c +++ b/src/mesa/drivers/dri/i965/brw_wm_iz.c @@ -120,24 +120,38 @@ const struct { * \param line_aa AA_NEVER, AA_ALWAYS or AA_SOMETIMES * \param lookup bitmask of IZ_* flags */ -void brw_wm_lookup_iz( GLuint line_aa, +void brw_wm_lookup_iz( struct intel_context *intel, + GLuint line_aa, GLuint lookup, GLboolean ps_uses_depth, struct brw_wm_prog_key *key ) { GLuint reg = 2; + GLboolean kill_stats_promoted_workaround = GL_FALSE; assert (lookup < IZ_BIT_MAX); - + + /* Crazy workaround in the windowizer, which we need to track in + * our register allocation and render target writes. See the "If + * statistics are enabled..." paragraph of 11.5.3.2: Early Depth + * Test Cases [Pre-DevGT] of the 3D Pipeline - Windower B-Spec. + */ + if (intel->stats_wm && + (lookup & IZ_PS_KILL_ALPHATEST_BIT) && + wm_iz_table[lookup].mode == P) { + kill_stats_promoted_workaround = GL_TRUE; + } + if (lookup & IZ_PS_COMPUTES_DEPTH_BIT) key->computes_depth = 1; - if (wm_iz_table[lookup].sd_present || ps_uses_depth) { + if (wm_iz_table[lookup].sd_present || ps_uses_depth || + kill_stats_promoted_workaround) { key->source_depth_reg = reg; reg += 2; } - if (wm_iz_table[lookup].sd_to_rt) + if (wm_iz_table[lookup].sd_to_rt || kill_stats_promoted_workaround) key->source_depth_to_render_target = 1; if (wm_iz_table[lookup].ds_present || line_aa != AA_NEVER) { diff --git a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c index 1fc802cfa6..fea96d3538 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c @@ -100,10 +100,13 @@ struct wm_sampler_key { * Sets the sampler state for a single unit based off of the sampler key * entry. */ -static void brw_update_sampler_state(struct wm_sampler_entry *key, +static void brw_update_sampler_state(struct brw_context *brw, + struct wm_sampler_entry *key, drm_intel_bo *sdc_bo, struct brw_sampler_state *sampler) { + struct intel_context *intel = &brw->intel; + memset(sampler, 0, sizeof(*sampler)); switch (key->minfilter) { @@ -163,6 +166,10 @@ static void brw_update_sampler_state(struct wm_sampler_entry *key, sampler->ss1.s_wrap_mode = translate_wrap_mode(key->wrap_s); sampler->ss1.t_wrap_mode = translate_wrap_mode(key->wrap_t); + if (intel->gen >= 6 && + sampler->ss0.min_filter != sampler->ss0.mag_filter) + sampler->ss0.min_mag_neq = 1; + /* Cube-maps on 965 and later must use the same wrap mode for all 3 * coordinate dimensions. Futher, only CUBE and CLAMP are valid. */ @@ -226,7 +233,7 @@ static void brw_wm_sampler_populate_key(struct brw_context *brw, struct wm_sampler_key *key) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; int unit; char *last_entry_end = ((char*)&key->sampler_count) + sizeof(key->sampler_count); @@ -294,7 +301,7 @@ brw_wm_sampler_populate_key(struct brw_context *brw, */ static void upload_wm_samplers( struct brw_context *brw ) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct wm_sampler_key key; int i, sampler_key_size; @@ -329,7 +336,7 @@ static void upload_wm_samplers( struct brw_context *brw ) if (brw->wm.sdc_bo[i] == NULL) continue; - brw_update_sampler_state(&key.sampler[i], brw->wm.sdc_bo[i], + brw_update_sampler_state(brw, &key.sampler[i], brw->wm.sdc_bo[i], &sampler[i]); } diff --git a/src/mesa/drivers/dri/i965/brw_wm_state.c b/src/mesa/drivers/dri/i965/brw_wm_state.c index 6699d0a73e..817adefb0c 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_state.c @@ -58,7 +58,7 @@ struct brw_wm_unit_key { static void wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; const struct gl_fragment_program *fp = brw->fragment_program; const struct brw_fragment_program *bfp = (struct brw_fragment_program *) fp; struct intel_context *intel = &brw->intel; @@ -108,16 +108,11 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key) * 8-wide. */ if (ctx->Shader.CurrentProgram) { - int i; + struct brw_shader *shader = (struct brw_shader *) + ctx->Shader.CurrentProgram->_LinkedShaders[MESA_SHADER_FRAGMENT]; - for (i = 0; i < ctx->Shader.CurrentProgram->_NumLinkedShaders; i++) { - struct brw_shader *shader = - (struct brw_shader *)ctx->Shader.CurrentProgram->_LinkedShaders[i];; - - if (shader->base.Type == GL_FRAGMENT_SHADER && - shader->ir != NULL) { - key->is_glsl = GL_TRUE; - } + if (shader != NULL && shader->ir != NULL) { + key->is_glsl = GL_TRUE; } } diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 17b016b569..5588702afc 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -89,6 +89,18 @@ static GLuint translate_tex_format( gl_format mesa_format, case MESA_FORMAT_AL1616: return BRW_SURFACEFORMAT_L16A16_UNORM; + case MESA_FORMAT_R8: + return BRW_SURFACEFORMAT_R8_UNORM; + + case MESA_FORMAT_R16: + return BRW_SURFACEFORMAT_R16_UNORM; + + case MESA_FORMAT_RG88: + return BRW_SURFACEFORMAT_R8G8_UNORM; + + case MESA_FORMAT_RG1616: + return BRW_SURFACEFORMAT_R16G16_UNORM; + case MESA_FORMAT_RGB888: assert(0); /* not supported for sampling */ return BRW_SURFACEFORMAT_R8G8B8_UNORM; @@ -197,7 +209,7 @@ brw_set_surface_tiling(struct brw_surface_state *surf, uint32_t tiling) } static void -brw_update_texture_surface( GLcontext *ctx, GLuint unit ) +brw_update_texture_surface( struct gl_context *ctx, GLuint unit ) { struct brw_context *brw = brw_context(ctx); struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current; @@ -303,7 +315,7 @@ brw_create_constant_surface(struct brw_context *brw, static void prepare_wm_constants(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; struct intel_context *intel = &brw->intel; struct brw_fragment_program *fp = (struct brw_fragment_program *) brw->fragment_program; @@ -395,7 +407,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw, unsigned int unit) { struct intel_context *intel = &brw->intel; - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; drm_intel_bo *region_bo = NULL; struct intel_renderbuffer *irb = intel_renderbuffer(rb); struct intel_region *region = irb ? irb->region : NULL; @@ -429,6 +441,9 @@ brw_update_renderbuffer_surface(struct brw_context *brw, case MESA_FORMAT_XRGB8888: key.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM; break; + case MESA_FORMAT_SARGB8: + key.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM_SRGB; + break; case MESA_FORMAT_RGB565: key.surface_format = BRW_SURFACEFORMAT_B5G6R5_UNORM; break; @@ -441,6 +456,18 @@ brw_update_renderbuffer_surface(struct brw_context *brw, case MESA_FORMAT_A8: key.surface_format = BRW_SURFACEFORMAT_A8_UNORM; break; + case MESA_FORMAT_R8: + key.surface_format = BRW_SURFACEFORMAT_R8_UNORM; + break; + case MESA_FORMAT_R16: + key.surface_format = BRW_SURFACEFORMAT_R16_UNORM; + break; + case MESA_FORMAT_RG88: + key.surface_format = BRW_SURFACEFORMAT_R8G8_UNORM; + break; + case MESA_FORMAT_RG1616: + key.surface_format = BRW_SURFACEFORMAT_R16G16_UNORM; + break; default: _mesa_problem(ctx, "Bad renderbuffer format: %d\n", irb->Base.Format); } @@ -545,7 +572,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw, static void prepare_wm_surfaces(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; int i; int nr_surfaces = 0; @@ -592,7 +619,7 @@ prepare_wm_surfaces(struct brw_context *brw) static void upload_wm_surfaces(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; GLuint i; /* _NEW_BUFFERS | _NEW_COLOR */ diff --git a/src/mesa/drivers/dri/i965/gen6_cc.c b/src/mesa/drivers/dri/i965/gen6_cc.c index 26f1070a16..4a98e26862 100644 --- a/src/mesa/drivers/dri/i965/gen6_cc.c +++ b/src/mesa/drivers/dri/i965/gen6_cc.c @@ -49,7 +49,7 @@ static void blend_state_populate_key(struct brw_context *brw, struct gen6_blend_state_key *key) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; memset(key, 0, sizeof(*key)); @@ -181,7 +181,7 @@ static void color_calc_state_populate_key(struct brw_context *brw, struct gen6_color_calc_state_key *key) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; memset(key, 0, sizeof(*key)); diff --git a/src/mesa/drivers/dri/i965/gen6_clip_state.c b/src/mesa/drivers/dri/i965/gen6_clip_state.c index acc4b7f101..bf53146f11 100644 --- a/src/mesa/drivers/dri/i965/gen6_clip_state.c +++ b/src/mesa/drivers/dri/i965/gen6_clip_state.c @@ -34,7 +34,7 @@ static void upload_clip_state(struct brw_context *brw) { struct intel_context *intel = &brw->intel; - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; uint32_t depth_clamp = 0; uint32_t provoking; @@ -59,7 +59,7 @@ upload_clip_state(struct brw_context *brw) GEN6_CLIP_XY_TEST | depth_clamp | provoking); - OUT_BATCH(0); + OUT_BATCH(GEN6_CLIP_FORCE_ZERO_RTAINDEX); ADVANCE_BATCH(); intel_batchbuffer_emit_mi_flush(intel->batch); diff --git a/src/mesa/drivers/dri/i965/gen6_depthstencil.c b/src/mesa/drivers/dri/i965/gen6_depthstencil.c index d9eca9af35..96e6eade6b 100644 --- a/src/mesa/drivers/dri/i965/gen6_depthstencil.c +++ b/src/mesa/drivers/dri/i965/gen6_depthstencil.c @@ -41,7 +41,7 @@ static void depth_stencil_state_populate_key(struct brw_context *brw, struct brw_depth_stencil_state_key *key) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; const unsigned back = ctx->Stencil._BackFace; memset(key, 0, sizeof(*key)); diff --git a/src/mesa/drivers/dri/i965/gen6_scissor_state.c b/src/mesa/drivers/dri/i965/gen6_scissor_state.c index 34a9dc234c..5684c2e44c 100644 --- a/src/mesa/drivers/dri/i965/gen6_scissor_state.c +++ b/src/mesa/drivers/dri/i965/gen6_scissor_state.c @@ -33,9 +33,9 @@ static void prepare_scissor_state(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; const GLboolean render_to_fbo = (ctx->DrawBuffer->Name != 0); - struct gen6_scissor_state scissor; + struct gen6_scissor_rect scissor; /* _NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT */ @@ -84,7 +84,6 @@ static void upload_scissor_state_pointers(struct brw_context *brw) OUT_RELOC(brw->sf.state_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0); ADVANCE_BATCH(); - intel_batchbuffer_emit_mi_flush(intel->batch); } diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c b/src/mesa/drivers/dri/i965/gen6_sf_state.c index 6820ca3abf..377b3a41bd 100644 --- a/src/mesa/drivers/dri/i965/gen6_sf_state.c +++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c @@ -33,20 +33,29 @@ #include "intel_batchbuffer.h" static uint32_t -get_attr_override(struct brw_context *brw, int attr) +get_attr_override(struct brw_context *brw, int fs_attr) { - uint32_t attr_override; - int attr_index = 0, i; + int attr_index = 0, i, vs_attr; + + if (fs_attr <= FRAG_ATTRIB_TEX7) + vs_attr = fs_attr; + else if (fs_attr == FRAG_ATTRIB_FACE) + vs_attr = 0; /* XXX */ + else if (fs_attr == FRAG_ATTRIB_PNTC) + vs_attr = 0; /* XXX */ + else { + assert(fs_attr >= FRAG_ATTRIB_VAR0); + vs_attr = fs_attr - FRAG_ATTRIB_VAR0 + VERT_RESULT_VAR0; + } /* Find the source index (0 = first attribute after the 4D position) * for this output attribute. attr is currently a VERT_RESULT_* but should * be FRAG_ATTRIB_*. */ - for (i = 0; i < attr; i++) { + for (i = 1; i < vs_attr; i++) { if (brw->vs.prog_data->outputs_written & BITFIELD64_BIT(i)) attr_index++; } - attr_override = attr_index; return attr_index; } @@ -55,18 +64,18 @@ static void upload_sf_state(struct brw_context *brw) { struct intel_context *intel = &brw->intel; - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; /* CACHE_NEW_VS_PROG */ uint32_t num_inputs = brw_count_bits(brw->vs.prog_data->outputs_written); - /* This should probably be FS inputs read */ - uint32_t num_outputs = brw_count_bits(brw->vs.prog_data->outputs_written); - uint32_t dw1, dw2, dw3, dw4; + uint32_t num_outputs = brw_count_bits(brw->fragment_program->Base.InputsRead); + uint32_t dw1, dw2, dw3, dw4, dw16; int i; /* _NEW_BUFFER */ GLboolean render_to_fbo = brw->intel.ctx.DrawBuffer->Name != 0; int attr = 0; dw1 = + GEN6_SF_SWIZZLE_ENABLE | num_outputs << GEN6_SF_NUM_OUTPUTS_SHIFT | (num_inputs + 1) / 2 << GEN6_SF_URB_ENTRY_READ_LENGTH_SHIFT | 1 << GEN6_SF_URB_ENTRY_READ_OFFSET_SHIFT; @@ -74,11 +83,15 @@ upload_sf_state(struct brw_context *brw) GEN6_SF_STATISTICS_ENABLE; dw3 = 0; dw4 = 0; + dw16 = 0; /* _NEW_POLYGON */ if ((ctx->Polygon.FrontFace == GL_CCW) ^ render_to_fbo) dw2 |= GEN6_SF_WINDING_CCW; + if (ctx->Polygon.OffsetFill) + dw2 |= GEN6_SF_GLOBAL_DEPTH_OFFSET_SOLID; + /* _NEW_SCISSOR */ if (ctx->Scissor.Enabled) dw3 |= GEN6_SF_SCISSOR_ENABLE; @@ -113,12 +126,13 @@ upload_sf_state(struct brw_context *brw) } /* _NEW_POINT */ - if (ctx->Point._Attenuated) + if (!(ctx->VertexProgram.PointSizeEnabled || + ctx->Point._Attenuated)) dw4 |= GEN6_SF_USE_STATE_POINT_WIDTH; dw4 |= U_FIXED(CLAMP(ctx->Point.Size, 0.125, 225.875), 3) << GEN6_SF_POINT_WIDTH_SHIFT; - if (render_to_fbo) + if (ctx->Point.SpriteOrigin == GL_LOWER_LEFT) dw1 |= GEN6_SF_POINT_SPRITE_LOWERLEFT; /* _NEW_LIGHT */ @@ -132,6 +146,13 @@ upload_sf_state(struct brw_context *brw) (1 << GEN6_SF_TRIFAN_PROVOKE_SHIFT); } + if (ctx->Point.PointSprite) { + for (i = 0; i < 8; i++) { + if (ctx->Point.CoordReplace[i]) + dw16 |= (1 << i); + } + } + BEGIN_BATCH(20); OUT_BATCH(CMD_3D_SF_STATE << 16 | (20 - 2)); OUT_BATCH(dw1); @@ -144,11 +165,8 @@ upload_sf_state(struct brw_context *brw) for (i = 0; i < 8; i++) { uint32_t attr_overrides = 0; - /* These should be generating FS inputs read instead of VS - * outputs written - */ for (; attr < 64; attr++) { - if (brw->vs.prog_data->outputs_written & BITFIELD64_BIT(attr)) { + if (brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(attr)) { attr_overrides |= get_attr_override(brw, attr); attr++; break; @@ -156,7 +174,7 @@ upload_sf_state(struct brw_context *brw) } for (; attr < 64; attr++) { - if (brw->vs.prog_data->outputs_written & BITFIELD64_BIT(attr)) { + if (brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(attr)) { attr_overrides |= get_attr_override(brw, attr) << 16; attr++; break; @@ -164,7 +182,7 @@ upload_sf_state(struct brw_context *brw) } OUT_BATCH(attr_overrides); } - OUT_BATCH(0); /* point sprite texcoord bitmask */ + OUT_BATCH(dw16); /* point sprite texcoord bitmask */ OUT_BATCH(0); /* constant interp bitmask */ OUT_BATCH(0); /* wrapshortest enables 0-7 */ OUT_BATCH(0); /* wrapshortest enables 8-15 */ diff --git a/src/mesa/drivers/dri/i965/gen6_viewport_state.c b/src/mesa/drivers/dri/i965/gen6_viewport_state.c index 301c68e7f9..b515e7712e 100644 --- a/src/mesa/drivers/dri/i965/gen6_viewport_state.c +++ b/src/mesa/drivers/dri/i965/gen6_viewport_state.c @@ -65,7 +65,7 @@ const struct brw_tracked_state gen6_clip_vp = { static void prepare_sf_vp(struct brw_context *brw) { - GLcontext *ctx = &brw->intel.ctx; + struct gl_context *ctx = &brw->intel.ctx; const GLfloat depth_scale = 1.0F / ctx->DrawBuffer->_DepthMaxF; struct brw_sf_viewport sfv; GLfloat y_scale, y_bias; @@ -107,7 +107,9 @@ const struct brw_tracked_state gen6_sf_vp = { static void prepare_viewport_state_pointers(struct brw_context *brw) { - brw_add_validated_bo(brw, brw->sf.state_bo); + brw_add_validated_bo(brw, brw->clip.vp_bo); + brw_add_validated_bo(brw, brw->sf.vp_bo); + brw_add_validated_bo(brw, brw->cc.vp_bo); } static void upload_viewport_state_pointers(struct brw_context *brw) diff --git a/src/mesa/drivers/dri/i965/gen6_vs_state.c b/src/mesa/drivers/dri/i965/gen6_vs_state.c index 4080a9dedf..3eca4e971b 100644 --- a/src/mesa/drivers/dri/i965/gen6_vs_state.c +++ b/src/mesa/drivers/dri/i965/gen6_vs_state.c @@ -37,7 +37,7 @@ static void upload_vs_state(struct brw_context *brw) { struct intel_context *intel = &brw->intel; - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; const struct brw_vertex_program *vp = brw_vertex_program_const(brw->vertex_program); unsigned int nr_params = vp->program.Base.Parameters->NumParameters; @@ -93,7 +93,7 @@ upload_vs_state(struct brw_context *brw) BEGIN_BATCH(6); OUT_BATCH(CMD_3D_VS_STATE << 16 | (6 - 2)); OUT_RELOC(brw->vs.prog_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0); - OUT_BATCH((0 << GEN6_VS_SAMPLER_COUNT_SHIFT) | + OUT_BATCH(GEN6_VS_SPF_MODE | (0 << GEN6_VS_SAMPLER_COUNT_SHIFT) | (brw->vs.nr_surfaces << GEN6_VS_BINDING_TABLE_ENTRY_COUNT_SHIFT)); OUT_BATCH(0); /* scratch space base offset */ OUT_BATCH((1 << GEN6_VS_DISPATCH_START_GRF_SHIFT) | diff --git a/src/mesa/drivers/dri/i965/gen6_wm_state.c b/src/mesa/drivers/dri/i965/gen6_wm_state.c index 2cd640de17..5810266635 100644 --- a/src/mesa/drivers/dri/i965/gen6_wm_state.c +++ b/src/mesa/drivers/dri/i965/gen6_wm_state.c @@ -37,7 +37,7 @@ static void prepare_wm_constants(struct brw_context *brw) { struct intel_context *intel = &brw->intel; - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; const struct brw_fragment_program *fp = brw_fragment_program_const(brw->fragment_program); @@ -81,7 +81,7 @@ static void upload_wm_state(struct brw_context *brw) { struct intel_context *intel = &brw->intel; - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; const struct brw_fragment_program *fp = brw_fragment_program_const(brw->fragment_program); uint32_t dw2, dw4, dw5, dw6; @@ -151,8 +151,9 @@ upload_wm_state(struct brw_context *brw) if (fp->program.UsesKill || ctx->Color.AlphaEnabled) dw5 |= GEN6_WM_KILL_ENABLE; - /* This should probably be FS inputs read */ - dw6 |= brw_count_bits(brw->vs.prog_data->outputs_written) << + dw6 |= GEN6_WM_PERSPECTIVE_PIXEL_BARYCENTRIC; + + dw6 |= brw_count_bits(brw->fragment_program->Base.InputsRead) << GEN6_WM_NUM_SF_OUTPUTS_SHIFT; BEGIN_BATCH(9); @@ -172,7 +173,8 @@ upload_wm_state(struct brw_context *brw) const struct brw_tracked_state gen6_wm_state = { .dirty = { - .mesa = _NEW_LINE | _NEW_POLYGONSTIPPLE | _NEW_COLOR, + .mesa = (_NEW_LINE | _NEW_POLYGONSTIPPLE | _NEW_COLOR | + _NEW_PROGRAM_CONSTANTS), .brw = (BRW_NEW_CURBE_OFFSETS | BRW_NEW_FRAGMENT_PROGRAM | BRW_NEW_NR_WM_SURFACES | diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c index ff741fc39a..9b39823917 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c @@ -264,10 +264,18 @@ intel_batchbuffer_emit_mi_flush(struct intel_batchbuffer *batch) struct intel_context *intel = batch->intel; if (intel->gen >= 6) { - BEGIN_BATCH(4); + BEGIN_BATCH(8); + + /* XXX workaround: issue any post sync != 0 before write cache flush = 1 */ + OUT_BATCH(_3DSTATE_PIPE_CONTROL); + OUT_BATCH(PIPE_CONTROL_WRITE_IMMEDIATE); + OUT_BATCH(0); /* write address */ + OUT_BATCH(0); /* write data */ + OUT_BATCH(_3DSTATE_PIPE_CONTROL); OUT_BATCH(PIPE_CONTROL_INSTRUCTION_FLUSH | PIPE_CONTROL_WRITE_FLUSH | + PIPE_CONTROL_DEPTH_CACHE_FLUSH | PIPE_CONTROL_NO_WRITE); OUT_BATCH(0); /* write address */ OUT_BATCH(0); /* write data */ diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c index 2c85ad3c36..a74e21720f 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.c +++ b/src/mesa/drivers/dri/intel/intel_blit.c @@ -210,7 +210,7 @@ intelEmitCopyBlit(struct intel_context *intel, * \param mask bitmask of BUFFER_BIT_* values indicating buffers to clear */ void -intelClearWithBlit(GLcontext *ctx, GLbitfield mask) +intelClearWithBlit(struct gl_context *ctx, GLbitfield mask) { struct intel_context *intel = intel_context(ctx); struct gl_framebuffer *fb = ctx->DrawBuffer; diff --git a/src/mesa/drivers/dri/intel/intel_blit.h b/src/mesa/drivers/dri/intel/intel_blit.h index 70d277df3c..0163146573 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.h +++ b/src/mesa/drivers/dri/intel/intel_blit.h @@ -33,7 +33,7 @@ extern void intelCopyBuffer(const __DRIdrawable * dpriv, const drm_clip_rect_t * rect); -extern void intelClearWithBlit(GLcontext * ctx, GLbitfield mask); +extern void intelClearWithBlit(struct gl_context * ctx, GLbitfield mask); GLboolean intelEmitCopyBlit(struct intel_context *intel, diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c index 117d4daf3b..1e99f9040a 100644 --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c @@ -40,7 +40,7 @@ #include "intel_regions.h" static GLboolean -intel_bufferobj_unmap(GLcontext * ctx, +intel_bufferobj_unmap(struct gl_context * ctx, GLenum target, struct gl_buffer_object *obj); /** Allocates a new drm_intel_bo to store the data for the buffer object. */ @@ -59,7 +59,7 @@ intel_bufferobj_alloc_buffer(struct intel_context *intel, * internal structure where somehow shared. */ static struct gl_buffer_object * -intel_bufferobj_alloc(GLcontext * ctx, GLuint name, GLenum target) +intel_bufferobj_alloc(struct gl_context * ctx, GLuint name, GLenum target) { struct intel_buffer_object *obj = CALLOC_STRUCT(intel_buffer_object); @@ -101,7 +101,7 @@ intel_bufferobj_cow(struct intel_context *intel, * Called via glDeleteBuffersARB(). */ static void -intel_bufferobj_free(GLcontext * ctx, struct gl_buffer_object *obj) +intel_bufferobj_free(struct gl_context * ctx, struct gl_buffer_object *obj) { struct intel_context *intel = intel_context(ctx); struct intel_buffer_object *intel_obj = intel_buffer_object(obj); @@ -136,7 +136,7 @@ intel_bufferobj_free(GLcontext * ctx, struct gl_buffer_object *obj) * \return GL_TRUE for success, GL_FALSE if out of memory */ static GLboolean -intel_bufferobj_data(GLcontext * ctx, +intel_bufferobj_data(struct gl_context * ctx, GLenum target, GLsizeiptrARB size, const GLvoid * data, @@ -193,7 +193,7 @@ intel_bufferobj_data(GLcontext * ctx, * Called via glBufferSubDataARB(). */ static void -intel_bufferobj_subdata(GLcontext * ctx, +intel_bufferobj_subdata(struct gl_context * ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, @@ -239,7 +239,7 @@ intel_bufferobj_subdata(GLcontext * ctx, * Called via glGetBufferSubDataARB(). */ static void -intel_bufferobj_get_subdata(GLcontext * ctx, +intel_bufferobj_get_subdata(struct gl_context * ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, @@ -260,7 +260,7 @@ intel_bufferobj_get_subdata(GLcontext * ctx, * Called via glMapBufferARB(). */ static void * -intel_bufferobj_map(GLcontext * ctx, +intel_bufferobj_map(struct gl_context * ctx, GLenum target, GLenum access, struct gl_buffer_object *obj) { @@ -322,7 +322,7 @@ intel_bufferobj_map(GLcontext * ctx, * and blit it into the real BO at unmap time. */ static void * -intel_bufferobj_map_range(GLcontext * ctx, +intel_bufferobj_map_range(struct gl_context * ctx, GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, struct gl_buffer_object *obj) { @@ -415,7 +415,7 @@ intel_bufferobj_map_range(GLcontext * ctx, * would defeat the point. */ static void -intel_bufferobj_flush_mapped_range(GLcontext *ctx, GLenum target, +intel_bufferobj_flush_mapped_range(struct gl_context *ctx, GLenum target, GLintptr offset, GLsizeiptr length, struct gl_buffer_object *obj) { @@ -449,7 +449,7 @@ intel_bufferobj_flush_mapped_range(GLcontext *ctx, GLenum target, * Called via glUnmapBuffer(). */ static GLboolean -intel_bufferobj_unmap(GLcontext * ctx, +intel_bufferobj_unmap(struct gl_context * ctx, GLenum target, struct gl_buffer_object *obj) { struct intel_context *intel = intel_context(ctx); @@ -537,7 +537,7 @@ intel_bufferobj_buffer(struct intel_context *intel, } static void -intel_bufferobj_copy_subdata(GLcontext *ctx, +intel_bufferobj_copy_subdata(struct gl_context *ctx, struct gl_buffer_object *src, struct gl_buffer_object *dst, GLintptr read_offset, GLintptr write_offset, @@ -596,7 +596,7 @@ intel_bufferobj_copy_subdata(GLcontext *ctx, #if FEATURE_APPLE_object_purgeable static GLenum -intel_buffer_purgeable(GLcontext * ctx, +intel_buffer_purgeable(struct gl_context * ctx, drm_intel_bo *buffer, GLenum option) { @@ -609,7 +609,7 @@ intel_buffer_purgeable(GLcontext * ctx, } static GLenum -intel_buffer_object_purgeable(GLcontext * ctx, +intel_buffer_object_purgeable(struct gl_context * ctx, struct gl_buffer_object *obj, GLenum option) { @@ -636,7 +636,7 @@ intel_buffer_object_purgeable(GLcontext * ctx, } static GLenum -intel_texture_object_purgeable(GLcontext * ctx, +intel_texture_object_purgeable(struct gl_context * ctx, struct gl_texture_object *obj, GLenum option) { @@ -650,7 +650,7 @@ intel_texture_object_purgeable(GLcontext * ctx, } static GLenum -intel_render_object_purgeable(GLcontext * ctx, +intel_render_object_purgeable(struct gl_context * ctx, struct gl_renderbuffer *obj, GLenum option) { @@ -664,7 +664,7 @@ intel_render_object_purgeable(GLcontext * ctx, } static GLenum -intel_buffer_unpurgeable(GLcontext * ctx, +intel_buffer_unpurgeable(struct gl_context * ctx, drm_intel_bo *buffer, GLenum option) { @@ -678,7 +678,7 @@ intel_buffer_unpurgeable(GLcontext * ctx, } static GLenum -intel_buffer_object_unpurgeable(GLcontext * ctx, +intel_buffer_object_unpurgeable(struct gl_context * ctx, struct gl_buffer_object *obj, GLenum option) { @@ -686,7 +686,7 @@ intel_buffer_object_unpurgeable(GLcontext * ctx, } static GLenum -intel_texture_object_unpurgeable(GLcontext * ctx, +intel_texture_object_unpurgeable(struct gl_context * ctx, struct gl_texture_object *obj, GLenum option) { @@ -700,7 +700,7 @@ intel_texture_object_unpurgeable(GLcontext * ctx, } static GLenum -intel_render_object_unpurgeable(GLcontext * ctx, +intel_render_object_unpurgeable(struct gl_context * ctx, struct gl_renderbuffer *obj, GLenum option) { diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c index 1bff344a45..ee551ef60d 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.c +++ b/src/mesa/drivers/dri/intel/intel_buffers.c @@ -88,7 +88,7 @@ intel_check_front_buffer_rendering(struct intel_context *intel) * color buffers. */ void -intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb) +intel_draw_buffer(struct gl_context * ctx, struct gl_framebuffer *fb) { struct intel_context *intel = intel_context(ctx); struct intel_region *colorRegions[MAX_DRAW_BUFFERS], *depthRegion = NULL; @@ -262,7 +262,7 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb) static void -intelDrawBuffer(GLcontext * ctx, GLenum mode) +intelDrawBuffer(struct gl_context * ctx, GLenum mode) { if ((ctx->DrawBuffer != NULL) && (ctx->DrawBuffer->Name == 0)) { struct intel_context *const intel = intel_context(ctx); @@ -285,7 +285,7 @@ intelDrawBuffer(GLcontext * ctx, GLenum mode) static void -intelReadBuffer(GLcontext * ctx, GLenum mode) +intelReadBuffer(struct gl_context * ctx, GLenum mode) { if ((ctx->DrawBuffer != NULL) && (ctx->DrawBuffer->Name == 0)) { struct intel_context *const intel = intel_context(ctx); diff --git a/src/mesa/drivers/dri/intel/intel_buffers.h b/src/mesa/drivers/dri/intel/intel_buffers.h index abb86aade6..2d4613b295 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.h +++ b/src/mesa/drivers/dri/intel/intel_buffers.h @@ -41,7 +41,7 @@ extern struct intel_region *intel_drawbuf_region(struct intel_context *intel); extern void intel_check_front_buffer_rendering(struct intel_context *intel); -extern void intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb); +extern void intel_draw_buffer(struct gl_context * ctx, struct gl_framebuffer *fb); extern void intelInitBufferFuncs(struct dd_function_table *functions); @@ -50,7 +50,7 @@ void intel_get_cliprects(struct intel_context *intel, unsigned int *num_cliprects, int *x_off, int *y_off); #ifdef I915 -void intelCalcViewport(GLcontext * ctx); +void intelCalcViewport(struct gl_context * ctx); #endif #endif /* INTEL_BUFFERS_H */ diff --git a/src/mesa/drivers/dri/intel/intel_chipset.h b/src/mesa/drivers/dri/intel/intel_chipset.h index b5f180bbc8..1e7ceed32a 100644 --- a/src/mesa/drivers/dri/intel/intel_chipset.h +++ b/src/mesa/drivers/dri/intel/intel_chipset.h @@ -71,9 +71,13 @@ #define PCI_CHIP_ILD_G 0x0042 #define PCI_CHIP_ILM_G 0x0046 -#define PCI_CHIP_SANDYBRIDGE 0x0102 -#define PCI_CHIP_SANDYBRIDGE_M 0x0106 -#define PCI_CHIP_SANDYBRIDGE_M_D0 0x0126 +#define PCI_CHIP_SANDYBRIDGE_GT1 0x0102 /* Desktop */ +#define PCI_CHIP_SANDYBRIDGE_GT2 0x0112 +#define PCI_CHIP_SANDYBRIDGE_GT2_PLUS 0x0122 +#define PCI_CHIP_SANDYBRIDGE_M_GT1 0x0106 /* Mobile */ +#define PCI_CHIP_SANDYBRIDGE_M_GT2 0x0116 +#define PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS 0x0126 +#define PCI_CHIP_SANDYBRIDGE_S 0x010A /* Server */ #define IS_MOBILE(devid) (devid == PCI_CHIP_I855_GM || \ devid == PCI_CHIP_I915_GM || \ @@ -119,9 +123,13 @@ /* Compat macro for intel_decode.c */ #define IS_IRONLAKE(devid) IS_GEN5(devid) -#define IS_GEN6(devid) (devid == PCI_CHIP_SANDYBRIDGE || \ - devid == PCI_CHIP_SANDYBRIDGE_M || \ - devid == PCI_CHIP_SANDYBRIDGE_M_D0) +#define IS_GEN6(devid) (devid == PCI_CHIP_SANDYBRIDGE_GT1 || \ + devid == PCI_CHIP_SANDYBRIDGE_GT2 || \ + devid == PCI_CHIP_SANDYBRIDGE_GT2_PLUS || \ + devid == PCI_CHIP_SANDYBRIDGE_M_GT1 || \ + devid == PCI_CHIP_SANDYBRIDGE_M_GT2 || \ + devid == PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS || \ + devid == PCI_CHIP_SANDYBRIDGE_S) #define IS_965(devid) (IS_GEN4(devid) || \ IS_G4X(devid) || \ diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c index 3c22118866..d7814635b7 100644 --- a/src/mesa/drivers/dri/intel/intel_clear.c +++ b/src/mesa/drivers/dri/intel/intel_clear.c @@ -62,7 +62,7 @@ static const char *buffer_names[] = { * Called by ctx->Driver.Clear. */ static void -intelClear(GLcontext *ctx, GLbitfield mask) +intelClear(struct gl_context *ctx, GLbitfield mask) { struct intel_context *intel = intel_context(ctx); const GLuint colorMask = *((GLuint *) & ctx->Color.ColorMask[0]); diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 08069d71dd..7ace50bde9 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -67,7 +67,7 @@ int INTEL_DEBUG = (0); static const GLubyte * -intelGetString(GLcontext * ctx, GLenum name) +intelGetString(struct gl_context * ctx, GLenum name) { const struct intel_context *const intel = intel_context(ctx); const char *chipset; @@ -163,6 +163,19 @@ intelGetString(GLcontext * ctx, GLenum name) case PCI_CHIP_ILM_G: chipset = "Intel(R) Ironlake Mobile"; break; + case PCI_CHIP_SANDYBRIDGE_GT1: + case PCI_CHIP_SANDYBRIDGE_GT2: + case PCI_CHIP_SANDYBRIDGE_GT2_PLUS: + chipset = "Intel(R) Sandybridge Desktop"; + break; + case PCI_CHIP_SANDYBRIDGE_M_GT1: + case PCI_CHIP_SANDYBRIDGE_M_GT2: + case PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS: + chipset = "Intel(R) Sandybridge Mobile"; + break; + case PCI_CHIP_SANDYBRIDGE_S: + chipset = "Intel(R) Sandybridge Server"; + break; default: chipset = "Unknown Intel Chipset"; break; @@ -177,7 +190,7 @@ intelGetString(GLcontext * ctx, GLenum name) } static void -intel_flush_front(GLcontext *ctx) +intel_flush_front(struct gl_context *ctx) { struct intel_context *intel = intel_context(ctx); __DRIcontext *driContext = intel->driContext; @@ -354,7 +367,7 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) case __DRI_BUFFER_ACCUM: default: fprintf(stderr, - "unhandled buffer attach event, attacment type %d\n", + "unhandled buffer attach event, attachment type %d\n", buffers[i].attachment); return; } @@ -465,7 +478,7 @@ intel_prepare_render(struct intel_context *intel) } static void -intel_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) +intel_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { struct intel_context *intel = intel_context(ctx); __DRIcontext *driContext = intel->driContext; @@ -514,7 +527,7 @@ static const struct dri_debug_control debug_control[] = { static void -intelInvalidateState(GLcontext * ctx, GLuint new_state) +intelInvalidateState(struct gl_context * ctx, GLuint new_state) { struct intel_context *intel = intel_context(ctx); @@ -531,7 +544,7 @@ intelInvalidateState(GLcontext * ctx, GLuint new_state) } void -intel_flush(GLcontext *ctx) +intel_flush(struct gl_context *ctx) { struct intel_context *intel = intel_context(ctx); @@ -546,7 +559,7 @@ intel_flush(GLcontext *ctx) } static void -intel_glFlush(GLcontext *ctx) +intel_glFlush(struct gl_context *ctx) { struct intel_context *intel = intel_context(ctx); @@ -556,7 +569,7 @@ intel_glFlush(GLcontext *ctx) } void -intelFinish(GLcontext * ctx) +intelFinish(struct gl_context * ctx) { struct gl_framebuffer *fb = ctx->DrawBuffer; int i; @@ -603,17 +616,17 @@ intelInitDriverFunctions(struct dd_function_table *functions) GLboolean intelInitContext(struct intel_context *intel, int api, - const __GLcontextModes * mesaVis, + const struct gl_config * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate, struct dd_function_table *functions) { - GLcontext *ctx = &intel->ctx; - GLcontext *shareCtx = (GLcontext *) sharedContextPrivate; + struct gl_context *ctx = &intel->ctx; + struct gl_context *shareCtx = (struct gl_context *) sharedContextPrivate; __DRIscreen *sPriv = driContextPriv->driScreenPriv; struct intel_screen *intelScreen = sPriv->private; int bo_reuse_mode; - __GLcontextModes visual; + struct gl_config visual; /* we can't do anything without a connection to the device */ if (intelScreen->bufmgr == NULL) @@ -724,7 +737,7 @@ intelInitContext(struct intel_context *intel, ctx->Const.MaxSamples = 1.0; /* reinitialize the context point state. - * It depend on constants in __GLcontextRec::Const + * It depend on constants in __struct gl_contextRec::Const */ _mesa_init_point(ctx); @@ -786,6 +799,11 @@ intelInitContext(struct intel_context *intel, if (INTEL_DEBUG & DEBUG_BUFMGR) dri_bufmgr_set_debug(intel->bufmgr, GL_TRUE); + /* XXX force SIMD8 kernel for Sandybridge before we fixed + SIMD16 interpolation. */ + if (intel->gen == 6) + INTEL_DEBUG |= DEBUG_GLSL_FORCE; + intel->batch = intel_batchbuffer_alloc(intel); intel_fbo_init(intel); diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 28d53284fd..46d10d74ba 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -106,11 +106,11 @@ struct intel_sync_object { }; /** - * intel_context is derived from Mesa's context class: GLcontext. + * intel_context is derived from Mesa's context class: struct gl_context. */ struct intel_context { - GLcontext ctx; /**< base class, must be first field */ + struct gl_context ctx; /**< base class, must be first field */ struct { @@ -256,7 +256,7 @@ struct intel_context __DRIcontext *driContext; struct intel_screen *intelScreen; - void (*saved_viewport)(GLcontext * ctx, + void (*saved_viewport)(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height); /** @@ -383,13 +383,13 @@ extern int INTEL_DEBUG; extern GLboolean intelInitContext(struct intel_context *intel, int api, - const __GLcontextModes * mesaVis, + const struct gl_config * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate, struct dd_function_table *functions); -extern void intelFinish(GLcontext * ctx); -extern void intel_flush(GLcontext * ctx); +extern void intelFinish(struct gl_context * ctx); +extern void intel_flush(struct gl_context * ctx); extern void intelInitDriverFunctions(struct dd_function_table *functions); @@ -476,7 +476,7 @@ void i915_set_buf_info_for_region(uint32_t *state, struct intel_region *region, * These are better-typed than the macros used previously: */ static INLINE struct intel_context * -intel_context(GLcontext * ctx) +intel_context(struct gl_context * ctx) { return (struct intel_context *) ctx; } diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index bf22a423fc..974045730b 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -31,7 +31,6 @@ #include "utils.h" -#define need_GL_ARB_copy_buffer #define need_GL_ARB_draw_elements_base_vertex #define need_GL_ARB_framebuffer_object #define need_GL_ARB_map_buffer_range @@ -47,7 +46,6 @@ #define need_GL_EXT_blend_equation_separate #define need_GL_EXT_blend_func_separate #define need_GL_EXT_blend_minmax -#define need_GL_EXT_cull_vertex #define need_GL_EXT_draw_buffers2 #define need_GL_EXT_fog_coord #define need_GL_EXT_framebuffer_blit @@ -79,8 +77,8 @@ * i965_dri. */ static const struct dri_extension card_extensions[] = { - { "GL_ARB_copy_buffer", GL_ARB_copy_buffer_functions }, { "GL_ARB_draw_elements_base_vertex", GL_ARB_draw_elements_base_vertex_functions }, + { "GL_ARB_explicit_attrib_location", NULL }, { "GL_ARB_half_float_pixel", NULL }, { "GL_ARB_map_buffer_range", GL_ARB_map_buffer_range_functions }, { "GL_ARB_multitexture", NULL }, @@ -89,7 +87,6 @@ static const struct dri_extension card_extensions[] = { { "GL_ARB_point_sprite", NULL }, { "GL_ARB_shader_objects", GL_ARB_shader_objects_functions }, { "GL_ARB_shading_language_100", GL_VERSION_2_0_functions }, - { "GL_ARB_shading_language_120", GL_VERSION_2_1_functions }, { "GL_ARB_sync", GL_ARB_sync_functions }, { "GL_ARB_texture_border_clamp", NULL }, { "GL_ARB_texture_cube_map", NULL }, @@ -109,7 +106,6 @@ static const struct dri_extension card_extensions[] = { { "GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions }, { "GL_EXT_blend_logic_op", NULL }, { "GL_EXT_blend_subtract", NULL }, - { "GL_EXT_cull_vertex", GL_EXT_cull_vertex_functions }, { "GL_EXT_framebuffer_blit", GL_EXT_framebuffer_blit_functions }, { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions }, { "GL_EXT_framebuffer_multisample", GL_EXT_framebuffer_multisample_functions }, @@ -133,7 +129,6 @@ static const struct dri_extension card_extensions[] = { { "GL_NV_blend_square", NULL }, { "GL_NV_vertex_program", GL_NV_vertex_program_functions }, { "GL_NV_vertex_program1_1", NULL }, - { "GL_SGIS_generate_mipmap", NULL }, #if FEATURE_OES_EGL_image { "GL_OES_EGL_image", GL_OES_EGL_image_functions }, #endif @@ -172,6 +167,7 @@ static const struct dri_extension brw_extensions[] = { { "GL_ARB_shadow", NULL }, { "GL_MESA_texture_signed_rgba", NULL }, { "GL_ARB_texture_non_power_of_two", NULL }, + { "GL_ARB_texture_rg", NULL }, { "GL_EXT_draw_buffers2", GL_EXT_draw_buffers2_functions }, { "GL_EXT_shadow_funcs", NULL }, { "GL_EXT_stencil_two_side", GL_EXT_stencil_two_side_functions }, @@ -201,18 +197,36 @@ static const struct dri_extension fragment_shader_extensions[] = { }; /** + * \brief Get GLSL version from the environment. + * + * If the environment variable INTEL_GLSL_VERSION is set, convert its value + * to an integer and return it. Otherwise, return the default version, 120. + */ +static GLuint +get_glsl_version() +{ + const char * s = getenv("INTEL_GLSL_VERSION"); + if (s == NULL) + return 120; + else + return (GLuint) atoi(s); +} + +/** * Initializes potential list of extensions if ctx == NULL, or actually enables * extensions for a context. */ void -intelInitExtensions(GLcontext *ctx) +intelInitExtensions(struct gl_context *ctx) { struct intel_context *intel = intel_context(ctx); - /* Disable imaging extension until convolution is working in teximage paths. - */ driInitExtensions(ctx, card_extensions, GL_FALSE); + _mesa_map_function_array(GL_VERSION_2_1_functions); + + ctx->Const.GLSLVersion = get_glsl_version(); + if (intel->gen >= 5) driInitExtensions(ctx, ironlake_extensions, GL_FALSE); diff --git a/src/mesa/drivers/dri/intel/intel_extensions.h b/src/mesa/drivers/dri/intel/intel_extensions.h index 236442a4d6..fb2a846d39 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.h +++ b/src/mesa/drivers/dri/intel/intel_extensions.h @@ -30,10 +30,10 @@ extern void -intelInitExtensions(GLcontext *ctx); +intelInitExtensions(struct gl_context *ctx); extern void -intelInitExtensionsES2(GLcontext *ctx); +intelInitExtensionsES2(struct gl_context *ctx); #endif diff --git a/src/mesa/drivers/dri/intel/intel_extensions_es2.c b/src/mesa/drivers/dri/intel/intel_extensions_es2.c index 24f64045ef..71c86339c7 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions_es2.c +++ b/src/mesa/drivers/dri/intel/intel_extensions_es2.c @@ -69,6 +69,7 @@ static const char *es2_extensions[] = { "GL_ARB_depth_texture", "GL_EXT_packed_depth_stencil", "GL_EXT_framebuffer_object", + "GL_EXT_texture_format_BGRA8888", #if FEATURE_OES_EGL_image "GL_OES_EGL_image", @@ -82,7 +83,7 @@ static const char *es2_extensions[] = { * extensions for a context. */ void -intelInitExtensionsES2(GLcontext *ctx) +intelInitExtensionsES2(struct gl_context *ctx) { int i; diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 2693b5fa72..862a13d2ea 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -50,7 +50,7 @@ * Create a new framebuffer object. */ static struct gl_framebuffer * -intel_new_framebuffer(GLcontext * ctx, GLuint name) +intel_new_framebuffer(struct gl_context * ctx, GLuint name) { /* Only drawable state in intel_framebuffer at this time, just use Mesa's * class @@ -81,7 +81,7 @@ intel_delete_renderbuffer(struct gl_renderbuffer *rb) * Return a pointer to a specific pixel in a renderbuffer. */ static void * -intel_get_pointer(GLcontext * ctx, struct gl_renderbuffer *rb, +intel_get_pointer(struct gl_context * ctx, struct gl_renderbuffer *rb, GLint x, GLint y) { /* By returning NULL we force all software rendering to go through @@ -96,17 +96,35 @@ intel_get_pointer(GLcontext * ctx, struct gl_renderbuffer *rb, * storage for a user-created renderbuffer. */ static GLboolean -intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, +intel_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { struct intel_context *intel = intel_context(ctx); struct intel_renderbuffer *irb = intel_renderbuffer(rb); - int cpp; + int cpp, tiling; ASSERT(rb->Name != 0); switch (internalFormat) { + case GL_RED: + case GL_R8: + rb->Format = MESA_FORMAT_R8; + rb->DataType = GL_UNSIGNED_BYTE; + break; + case GL_R16: + rb->Format = MESA_FORMAT_R16; + rb->DataType = GL_UNSIGNED_SHORT; + break; + case GL_RG: + case GL_RG8: + rb->Format = MESA_FORMAT_RG88; + rb->DataType = GL_UNSIGNED_BYTE; + break; + case GL_RG16: + rb->Format = MESA_FORMAT_RG1616; + rb->DataType = GL_UNSIGNED_SHORT; + break; case GL_R3_G3_B2: case GL_RGB4: case GL_RGB5: @@ -176,7 +194,13 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, /* alloc hardware renderbuffer */ DBG("Allocating %d x %d Intel RBO\n", width, height); - irb->region = intel_region_alloc(intel->intelScreen, I915_TILING_NONE, cpp, + tiling = I915_TILING_NONE; + + /* Gen6 requires depth must be tiling */ + if (intel->gen >= 6 && rb->Format == MESA_FORMAT_S8_Z24) + tiling = I915_TILING_Y; + + irb->region = intel_region_alloc(intel->intelScreen, tiling, cpp, width, height, GL_TRUE); if (!irb->region) return GL_FALSE; /* out of memory? */ @@ -192,7 +216,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, #if FEATURE_OES_EGL_image static void -intel_image_target_renderbuffer_storage(GLcontext *ctx, +intel_image_target_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, void *image_handle) { @@ -202,8 +226,8 @@ intel_image_target_renderbuffer_storage(GLcontext *ctx, __DRIimage *image; screen = intel->intelScreen->driScrnPriv; - image = screen->dri2.image->lookupEGLImage(intel->driContext, image_handle, - intel->driContext->loaderPrivate); + image = screen->dri2.image->lookupEGLImage(screen, image_handle, + screen->loaderPrivate); if (image == NULL) return; @@ -228,7 +252,7 @@ intel_image_target_renderbuffer_storage(GLcontext *ctx, * Not used for user-created renderbuffers! */ static GLboolean -intel_alloc_window_storage(GLcontext * ctx, struct gl_renderbuffer *rb, +intel_alloc_window_storage(struct gl_context * ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { ASSERT(rb->Name == 0); @@ -241,7 +265,7 @@ intel_alloc_window_storage(GLcontext * ctx, struct gl_renderbuffer *rb, static void -intel_resize_buffers(GLcontext *ctx, struct gl_framebuffer *fb, +intel_resize_buffers(struct gl_context *ctx, struct gl_framebuffer *fb, GLuint width, GLuint height) { int i; @@ -269,7 +293,7 @@ intel_resize_buffers(GLcontext *ctx, struct gl_framebuffer *fb, /** Dummy function for gl_renderbuffer::AllocStorage() */ static GLboolean -intel_nop_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, +intel_nop_alloc_storage(struct gl_context * ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { _mesa_problem(ctx, "intel_op_alloc_storage should never be called."); @@ -340,6 +364,14 @@ intel_create_renderbuffer(gl_format format) irb->Base._BaseFormat = GL_ALPHA; irb->Base.DataType = GL_UNSIGNED_BYTE; break; + case MESA_FORMAT_R8: + irb->Base._BaseFormat = GL_RED; + irb->Base.DataType = GL_UNSIGNED_BYTE; + break; + case MESA_FORMAT_RG88: + irb->Base._BaseFormat = GL_RG; + irb->Base.DataType = GL_UNSIGNED_BYTE; + break; default: _mesa_problem(NULL, "Unexpected intFormat in intel_create_renderbuffer"); @@ -364,7 +396,7 @@ intel_create_renderbuffer(gl_format format) * Typically called via glBindRenderbufferEXT(). */ static struct gl_renderbuffer * -intel_new_renderbuffer(GLcontext * ctx, GLuint name) +intel_new_renderbuffer(struct gl_context * ctx, GLuint name) { /*struct intel_context *intel = intel_context(ctx); */ struct intel_renderbuffer *irb; @@ -392,7 +424,7 @@ intel_new_renderbuffer(GLcontext * ctx, GLuint name) * Called via glBindFramebufferEXT(). */ static void -intel_bind_framebuffer(GLcontext * ctx, GLenum target, +intel_bind_framebuffer(struct gl_context * ctx, GLenum target, struct gl_framebuffer *fb, struct gl_framebuffer *fbread) { if (target == GL_FRAMEBUFFER_EXT || target == GL_DRAW_FRAMEBUFFER_EXT) { @@ -408,7 +440,7 @@ intel_bind_framebuffer(GLcontext * ctx, GLenum target, * Called via glFramebufferRenderbufferEXT(). */ static void -intel_framebuffer_renderbuffer(GLcontext * ctx, +intel_framebuffer_renderbuffer(struct gl_context * ctx, struct gl_framebuffer *fb, GLenum attachment, struct gl_renderbuffer *rb) { @@ -422,7 +454,7 @@ intel_framebuffer_renderbuffer(GLcontext * ctx, static GLboolean -intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb, +intel_update_wrapper(struct gl_context *ctx, struct intel_renderbuffer *irb, struct gl_texture_image *texImage) { if (texImage->TexFormat == MESA_FORMAT_ARGB8888) { @@ -433,6 +465,10 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb, irb->Base.DataType = GL_UNSIGNED_BYTE; DBG("Render to XGBA8 texture OK\n"); } + else if (texImage->TexFormat == MESA_FORMAT_SARGB8) { + irb->Base.DataType = GL_UNSIGNED_BYTE; + DBG("Render to SARGB8 texture OK\n"); + } else if (texImage->TexFormat == MESA_FORMAT_RGB565) { irb->Base.DataType = GL_UNSIGNED_BYTE; DBG("Render to RGB5 texture OK\n"); @@ -449,6 +485,22 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb, irb->Base.DataType = GL_UNSIGNED_BYTE; DBG("Render to A8 texture OK\n"); } + else if (texImage->TexFormat == MESA_FORMAT_R8) { + irb->Base.DataType = GL_UNSIGNED_BYTE; + DBG("Render to R8 texture OK\n"); + } + else if (texImage->TexFormat == MESA_FORMAT_RG88) { + irb->Base.DataType = GL_UNSIGNED_BYTE; + DBG("Render to RG88 texture OK\n"); + } + else if (texImage->TexFormat == MESA_FORMAT_R16) { + irb->Base.DataType = GL_UNSIGNED_SHORT; + DBG("Render to R8 texture OK\n"); + } + else if (texImage->TexFormat == MESA_FORMAT_RG1616) { + irb->Base.DataType = GL_UNSIGNED_SHORT; + DBG("Render to RG88 texture OK\n"); + } else if (texImage->TexFormat == MESA_FORMAT_Z16) { irb->Base.DataType = GL_UNSIGNED_SHORT; DBG("Render to DEPTH16 texture OK\n"); @@ -483,7 +535,7 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb, * This will have the region info needed for hardware rendering. */ static struct intel_renderbuffer * -intel_wrap_texture(GLcontext * ctx, struct gl_texture_image *texImage) +intel_wrap_texture(struct gl_context * ctx, struct gl_texture_image *texImage) { const GLuint name = ~0; /* not significant, but distinct for debugging */ struct intel_renderbuffer *irb; @@ -514,7 +566,7 @@ intel_wrap_texture(GLcontext * ctx, struct gl_texture_image *texImage) * before intel_finish_render_texture() is ever called. */ static void -intel_render_texture(GLcontext * ctx, +intel_render_texture(struct gl_context * ctx, struct gl_framebuffer *fb, struct gl_renderbuffer_attachment *att) { @@ -590,7 +642,7 @@ intel_render_texture(GLcontext * ctx, * Called by Mesa when rendering to a texture is done. */ static void -intel_finish_render_texture(GLcontext * ctx, +intel_finish_render_texture(struct gl_context * ctx, struct gl_renderbuffer_attachment *att) { struct intel_context *intel = intel_context(ctx); @@ -599,6 +651,9 @@ intel_finish_render_texture(GLcontext * ctx, tex_obj->Image[att->CubeMapFace][att->TextureLevel]; struct intel_texture_image *intel_image = intel_texture_image(image); + DBG("Finish render texture tid %lx tex=%u\n", + _glthread_GetID(), att->Texture->Name); + /* Flag that this image may now be validated into the object's miptree. */ intel_image->used_as_render_target = GL_FALSE; @@ -614,7 +669,7 @@ intel_finish_render_texture(GLcontext * ctx, * Do additional "completeness" testing of a framebuffer object. */ static void -intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) +intel_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb) { const struct intel_renderbuffer *depthRb = intel_get_renderbuffer(fb, BUFFER_DEPTH); @@ -655,10 +710,15 @@ intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) switch (irb->Base.Format) { case MESA_FORMAT_ARGB8888: case MESA_FORMAT_XRGB8888: + case MESA_FORMAT_SARGB8: case MESA_FORMAT_RGB565: case MESA_FORMAT_ARGB1555: case MESA_FORMAT_ARGB4444: case MESA_FORMAT_A8: + case MESA_FORMAT_R8: + case MESA_FORMAT_R16: + case MESA_FORMAT_RG88: + case MESA_FORMAT_RG1616: break; default: fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT; diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index d316d34d69..9c4e5c5ee8 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -333,7 +333,6 @@ intel_miptree_image_map(struct intel_context * intel, GLuint * row_stride, GLuint * image_offsets) { GLuint x, y; - DBG("%s \n", __FUNCTION__); if (row_stride) *row_stride = mt->region->pitch * mt->cpp; @@ -348,6 +347,8 @@ intel_miptree_image_map(struct intel_context * intel, image_offsets[i] = x + y * mt->region->pitch; } + DBG("%s \n", __FUNCTION__); + return intel_region_map(intel, mt->region); } else { assert(mt->level[level].depth == 1); @@ -355,6 +356,9 @@ intel_miptree_image_map(struct intel_context * intel, &x, &y); image_offsets[0] = 0; + DBG("%s: (%d,%d) -> (%d, %d)/%d\n", + __FUNCTION__, face, level, x, y, mt->region->pitch * mt->cpp); + return intel_region_map(intel, mt->region) + (x + y * mt->region->pitch) * mt->cpp; } @@ -385,7 +389,6 @@ intel_miptree_image_data(struct intel_context *intel, const GLuint depth = dst->level[level].depth; GLuint i; - DBG("%s: %d/%d\n", __FUNCTION__, face, level); for (i = 0; i < depth; i++) { GLuint dst_x, dst_y, height; @@ -395,6 +398,12 @@ intel_miptree_image_data(struct intel_context *intel, if(dst->compressed) height = (height + 3) / 4; + DBG("%s: %d/%d %p/%d -> (%d, %d)/%d (%d, %d)\n", + __FUNCTION__, face, level, + src, src_row_pitch * dst->cpp, + dst_x, dst_y, dst->region->pitch * dst->cpp, + dst->level[level].width, height); + intel_region_data(intel, dst->region, 0, dst_x, dst_y, src, diff --git a/src/mesa/drivers/dri/intel/intel_pixel.c b/src/mesa/drivers/dri/intel/intel_pixel.c index cb088e4032..60583ef4c0 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel.c +++ b/src/mesa/drivers/dri/intel/intel_pixel.c @@ -55,7 +55,7 @@ effective_func(GLenum func, GLboolean src_alpha_is_one) * glDraw/CopyPixels. */ GLboolean -intel_check_blit_fragment_ops(GLcontext * ctx, GLboolean src_alpha_is_one) +intel_check_blit_fragment_ops(struct gl_context * ctx, GLboolean src_alpha_is_one) { if (ctx->NewState) _mesa_update_state(ctx); diff --git a/src/mesa/drivers/dri/intel/intel_pixel.h b/src/mesa/drivers/dri/intel/intel_pixel.h index 743b6497c5..aef0e609da 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel.h +++ b/src/mesa/drivers/dri/intel/intel_pixel.h @@ -31,21 +31,21 @@ #include "main/mtypes.h" void intelInitPixelFuncs(struct dd_function_table *functions); -GLboolean intel_check_blit_fragment_ops(GLcontext * ctx, +GLboolean intel_check_blit_fragment_ops(struct gl_context * ctx, GLboolean src_alpha_is_one); GLboolean intel_check_blit_format(struct intel_region *region, GLenum format, GLenum type); -void intelReadPixels(GLcontext * ctx, +void intelReadPixels(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *pack, GLvoid * pixels); -void intelDrawPixels(GLcontext * ctx, +void intelDrawPixels(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, @@ -53,12 +53,12 @@ void intelDrawPixels(GLcontext * ctx, const struct gl_pixelstore_attrib *unpack, const GLvoid * pixels); -void intelCopyPixels(GLcontext * ctx, +void intelCopyPixels(struct gl_context * ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint destx, GLint desty, GLenum type); -void intelBitmap(GLcontext * ctx, +void intelBitmap(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index 02c0ffce31..63fb4b37b1 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -26,27 +26,17 @@ **************************************************************************/ #include "main/glheader.h" -#include "main/arbprogram.h" #include "main/enums.h" #include "main/image.h" #include "main/colormac.h" #include "main/mtypes.h" #include "main/macros.h" #include "main/bufferobj.h" -#include "main/polygon.h" -#include "main/pixelstore.h" -#include "main/polygon.h" #include "main/state.h" -#include "main/teximage.h" #include "main/texobj.h" -#include "main/texstate.h" -#include "main/texparam.h" -#include "main/varray.h" -#include "main/attrib.h" -#include "main/enable.h" -#include "main/viewport.h" #include "main/context.h" #include "swrast/swrast.h" +#include "drivers/common/meta.h" #include "intel_screen.h" #include "intel_context.h" @@ -68,7 +58,7 @@ * PBO bitmaps. I think they are probably pretty rare though - I * wonder if Xgl uses them? */ -static const GLubyte *map_pbo( GLcontext *ctx, +static const GLubyte *map_pbo( struct gl_context *ctx, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap ) @@ -177,7 +167,7 @@ y_flip(struct gl_framebuffer *fb, int y, int height) * Render a bitmap. */ static GLboolean -do_blit_bitmap( GLcontext *ctx, +do_blit_bitmap( struct gl_context *ctx, GLint dstx, GLint dsty, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, @@ -309,178 +299,6 @@ out: return GL_TRUE; } -static GLboolean -intel_texture_bitmap(GLcontext * ctx, - GLint dst_x, GLint dst_y, - GLsizei width, GLsizei height, - const struct gl_pixelstore_attrib *unpack, - const GLubyte *bitmap) -{ - struct intel_context *intel = intel_context(ctx); - static const char *fp = - "!!ARBfp1.0\n" - "TEMP val;\n" - "PARAM color=program.local[0];\n" - "TEX val, fragment.texcoord[0], texture[0], 2D;\n" - "ADD val, val.wwww, {-.5, -.5, -.5, -.5};\n" - "KIL val;\n" - "MOV result.color, color;\n" - "END\n"; - GLuint texname; - GLfloat vertices[4][4]; - GLint old_active_texture; - GLubyte *a8_bitmap; - GLfloat dst_z; - - /* We need a fragment program for the KIL effect */ - if (!ctx->Extensions.ARB_fragment_program || - !ctx->Extensions.ARB_vertex_program) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, - "glBitmap fallback: No fragment/vertex program support\n"); - return GL_FALSE; - } - - /* We're going to mess with texturing with no regard to existing texture - * state, so if there is some set up we have to bail. - */ - if (ctx->Texture._EnabledUnits != 0) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, "glBitmap fallback: texturing enabled\n"); - return GL_FALSE; - } - - /* Can't do textured DrawPixels with a fragment program, unless we were - * to generate a new program that sampled our texture and put the results - * in the fragment color before the user's program started. - */ - if (ctx->FragmentProgram.Enabled) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, "glBitmap fallback: fragment program enabled\n"); - return GL_FALSE; - } - - if (ctx->VertexProgram.Enabled) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, "glBitmap fallback: vertex program enabled\n"); - return GL_FALSE; - } - - if (!ctx->Extensions.ARB_texture_non_power_of_two && - (!is_power_of_two(width) || !is_power_of_two(height))) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, - "glBitmap() fallback: NPOT texture\n"); - return GL_FALSE; - } - - if (ctx->Fog.Enabled) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, "glBitmap() fallback: fog\n"); - return GL_FALSE; - } - - /* Check that we can load in a texture this big. */ - if (width > (1 << (ctx->Const.MaxTextureLevels - 1)) || - height > (1 << (ctx->Const.MaxTextureLevels - 1))) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, "glBitmap fallback: bitmap too large (%dx%d)\n", - width, height); - return GL_FALSE; - } - - if (_mesa_is_bufferobj(unpack->BufferObj)) { - bitmap = map_pbo(ctx, width, height, unpack, bitmap); - if (bitmap == NULL) - return GL_TRUE; /* even though this is an error, we're done */ - } - - /* Convert the A1 bitmap to an A8 format suitable for glTexImage */ - a8_bitmap = calloc(1, width * height); - _mesa_expand_bitmap(width, height, unpack, bitmap, a8_bitmap, width, 0xff); - - if (_mesa_is_bufferobj(unpack->BufferObj)) { - /* done with PBO so unmap it now */ - ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, - unpack->BufferObj); - } - - /* Save GL state before we start setting up our drawing */ - _mesa_PushAttrib(GL_ENABLE_BIT | GL_CURRENT_BIT | GL_POLYGON_BIT | - GL_TEXTURE_BIT | GL_VIEWPORT_BIT); - _mesa_PushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT | - GL_CLIENT_PIXEL_STORE_BIT); - old_active_texture = ctx->Texture.CurrentUnit; - - _mesa_Disable(GL_POLYGON_STIPPLE); - _mesa_PolygonMode(GL_FRONT_AND_BACK, GL_FILL); - - /* Upload our bitmap data to an alpha texture */ - _mesa_ActiveTextureARB(GL_TEXTURE0_ARB); - _mesa_Enable(GL_TEXTURE_2D); - _mesa_GenTextures(1, &texname); - _mesa_BindTexture(GL_TEXTURE_2D, texname); - _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - - _mesa_PixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE); - _mesa_PixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE); - _mesa_PixelStorei(GL_UNPACK_ROW_LENGTH, 0); - _mesa_PixelStorei(GL_UNPACK_SKIP_PIXELS, 0); - _mesa_PixelStorei(GL_UNPACK_SKIP_ROWS, 0); - _mesa_PixelStorei(GL_UNPACK_ALIGNMENT, 1); - _mesa_TexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, - GL_ALPHA, GL_UNSIGNED_BYTE, a8_bitmap); - free(a8_bitmap); - - meta_set_fragment_program(&intel->meta, &intel->meta.bitmap_fp, fp); - _mesa_ProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, 0, - ctx->Current.RasterColor); - meta_set_passthrough_vertex_program(&intel->meta); - meta_set_passthrough_transform(&intel->meta); - - /* convert rasterpos Z from [0,1] to NDC coord in [-1,1] */ - dst_z = -1.0 + 2.0 * ctx->Current.RasterPos[2]; - - /* RasterPos[2] already takes into account the DepthRange mapping. */ - _mesa_DepthRange(0.0, 1.0); - - vertices[0][0] = dst_x; - vertices[0][1] = dst_y; - vertices[0][2] = dst_z; - vertices[0][3] = 1.0; - vertices[1][0] = dst_x + width; - vertices[1][1] = dst_y; - vertices[1][2] = dst_z; - vertices[1][3] = 1.0; - vertices[2][0] = dst_x + width; - vertices[2][1] = dst_y + height; - vertices[2][2] = dst_z; - vertices[2][3] = 1.0; - vertices[3][0] = dst_x; - vertices[3][1] = dst_y + height; - vertices[3][2] = dst_z; - vertices[3][3] = 1.0; - - _mesa_VertexPointer(4, GL_FLOAT, 4 * sizeof(GLfloat), &vertices); - _mesa_Enable(GL_VERTEX_ARRAY); - meta_set_default_texrect(&intel->meta); - _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); - - meta_restore_texcoords(&intel->meta); - meta_restore_transform(&intel->meta); - meta_restore_fragment_program(&intel->meta); - meta_restore_vertex_program(&intel->meta); - - _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + old_active_texture); - _mesa_PopClientAttrib(); - _mesa_PopAttrib(); - - _mesa_DeleteTextures(1, &texname); - - return GL_TRUE; -} - /* There are a large number of possible ways to implement bitmap on * this hardware, most of them have some sort of drawback. Here are a * few that spring to mind: @@ -502,22 +320,21 @@ intel_texture_bitmap(GLcontext * ctx, * - Chop bitmap up into 32x32 squares and render w/polygon stipple. */ void -intelBitmap(GLcontext * ctx, +intelBitmap(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte * pixels) { + struct intel_context *intel = intel_context(ctx); + if (do_blit_bitmap(ctx, x, y, width, height, unpack, pixels)) return; - if (intel_texture_bitmap(ctx, x, y, width, height, - unpack, pixels)) - return; - - if (INTEL_DEBUG & DEBUG_PIXEL) - printf("%s: fallback to swrast\n", __FUNCTION__); + /* FIXME */ + if (intel->gen == 6) + return _swrast_Bitmap(ctx, x, y, width, height, unpack, pixels); - _swrast_Bitmap(ctx, x, y, width, height, unpack, pixels); + _mesa_meta_Bitmap(ctx, x, y, width, height, unpack, pixels); } diff --git a/src/mesa/drivers/dri/intel/intel_pixel_copy.c b/src/mesa/drivers/dri/intel/intel_pixel_copy.c index 2008a4c2be..c6b36ed429 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_copy.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_copy.c @@ -76,7 +76,7 @@ copypix_src_region(struct intel_context *intel, GLenum type) * we allow Scissor. */ static GLboolean -intel_check_copypixel_blit_fragment_ops(GLcontext * ctx) +intel_check_copypixel_blit_fragment_ops(struct gl_context * ctx) { if (ctx->NewState) _mesa_update_state(ctx); @@ -102,7 +102,7 @@ intel_check_copypixel_blit_fragment_ops(GLcontext * ctx) * CopyPixels with the blitter. Don't support zooming, pixel transfer, etc. */ static GLboolean -do_blit_copypixels(GLcontext * ctx, +do_blit_copypixels(struct gl_context * ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type) @@ -198,7 +198,7 @@ out: void -intelCopyPixels(GLcontext * ctx, +intelCopyPixels(struct gl_context * ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint destx, GLint desty, GLenum type) diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c index a40b232fff..2ec7ed8e26 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c @@ -30,224 +30,16 @@ #include "main/image.h" #include "main/mtypes.h" #include "main/teximage.h" -#include "main/texenv.h" #include "main/texobj.h" #include "main/texstate.h" -#include "main/texparam.h" -#include "main/varray.h" -#include "main/attrib.h" -#include "main/enable.h" -#include "main/buffers.h" -#include "main/fbobject.h" -#include "main/depth.h" -#include "main/hash.h" -#include "main/blend.h" #include "swrast/swrast.h" #include "drivers/common/meta.h" #include "intel_context.h" #include "intel_pixel.h" -#include "intel_fbo.h" - - -/** XXX compare perf of this vs. _mesa_meta_DrawPixels(STENCIL) */ -static GLboolean -intel_stencil_drawpixels(GLcontext * ctx, - GLint x, GLint y, - GLsizei width, GLsizei height, - GLenum format, - GLenum type, - const struct gl_pixelstore_attrib *unpack, - const GLvoid *pixels) -{ - struct intel_context *intel = intel_context(ctx); - GLuint texname, rb_name, fb_name, old_fb_name; - GLfloat vertices[4][2]; - struct intel_renderbuffer *irb; - struct intel_renderbuffer *depth_irb; - struct gl_pixelstore_attrib old_unpack; - GLstencil *stencil_pixels; - int row, y1, y2; - GLint old_active_texture; - GLboolean rendering_to_fbo = ctx->DrawBuffer->Name != 0; - - if (format != GL_STENCIL_INDEX) - return GL_FALSE; - - /* If there's nothing to write, we're done. */ - if (ctx->Stencil.WriteMask[0] == 0) - return GL_TRUE; - - /* Can't do a per-bit writemask while treating stencil as rgba data. */ - if ((ctx->Stencil.WriteMask[0] & 0xff) != 0xff) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, "glDrawPixels(STENCIL_INDEX) fallback: " - "stencil mask enabled\n"); - return GL_FALSE; - } - - /* We don't support stencil testing/ops here */ - if (ctx->Stencil._Enabled) - return GL_FALSE; - - /* We use FBOs for our wrapping of the depthbuffer into a color - * destination. - */ - if (!ctx->Extensions.EXT_framebuffer_object) - return GL_FALSE; - - /* We're going to mess with texturing with no regard to existing texture - * state, so if there is some set up we have to bail. - */ - if (ctx->Texture._EnabledUnits != 0) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, "glDrawPixels(STENCIL_INDEX) fallback: " - "texturing enabled\n"); - return GL_FALSE; - } - - /* Can't do textured DrawPixels with a fragment program, unless we were - * to generate a new program that sampled our texture and put the results - * in the fragment color before the user's program started. - */ - if (ctx->FragmentProgram.Enabled) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, "glDrawPixels(STENCIL_INDEX) fallback: " - "fragment program enabled\n"); - return GL_FALSE; - } - - /* Check that we can load in a texture this big. */ - if (width > (1 << (ctx->Const.MaxTextureLevels - 1)) || - height > (1 << (ctx->Const.MaxTextureLevels - 1))) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, "glDrawPixels(STENCIL_INDEX) fallback: " - "bitmap too large (%dx%d)\n", - width, height); - return GL_FALSE; - } - - if (!ctx->Extensions.ARB_texture_non_power_of_two && - (!is_power_of_two(width) || !is_power_of_two(height))) { - if (INTEL_DEBUG & DEBUG_FALLBACKS) - fprintf(stderr, - "glDrawPixels(GL_STENCIL_INDEX) fallback: NPOT texture\n"); - return GL_FALSE; - } - - _mesa_PushAttrib(GL_ENABLE_BIT | GL_TEXTURE_BIT | - GL_CURRENT_BIT | GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - _mesa_PushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT); - old_fb_name = ctx->DrawBuffer->Name; - old_active_texture = ctx->Texture.CurrentUnit; - - _mesa_Disable(GL_POLYGON_STIPPLE); - _mesa_Disable(GL_DEPTH_TEST); - _mesa_Disable(GL_STENCIL_TEST); - - /* Unpack the supplied stencil values into a ubyte buffer. */ - assert(sizeof(GLstencil) == sizeof(GLubyte)); - stencil_pixels = malloc(width * height * sizeof(GLstencil)); - for (row = 0; row < height; row++) { - GLvoid *source = _mesa_image_address2d(unpack, pixels, - width, height, - GL_COLOR_INDEX, type, - row, 0); - _mesa_unpack_stencil_span(ctx, width, GL_UNSIGNED_BYTE, - stencil_pixels + - row * width * sizeof(GLstencil), - type, source, unpack, ctx->_ImageTransferState); - } - - /* Take the current depth/stencil renderbuffer, and make a new one wrapping - * it which will be treated as GL_RGBA8 so we can render to it as a color - * buffer. - */ - depth_irb = intel_get_renderbuffer(ctx->DrawBuffer, BUFFER_DEPTH); - irb = intel_create_renderbuffer(MESA_FORMAT_ARGB8888); - irb->Base.Width = depth_irb->Base.Width; - irb->Base.Height = depth_irb->Base.Height; - intel_renderbuffer_set_region(intel, irb, depth_irb->region); - - /* Create a name for our renderbuffer, which lets us use other mesa - * rb functions for convenience. - */ - _mesa_GenRenderbuffersEXT(1, &rb_name); - irb->Base.RefCount++; - _mesa_HashInsert(ctx->Shared->RenderBuffers, rb_name, &irb->Base); - - /* Bind the new renderbuffer to the color attachment point. */ - _mesa_GenFramebuffersEXT(1, &fb_name); - _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb_name); - _mesa_FramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, - GL_COLOR_ATTACHMENT0_EXT, - GL_RENDERBUFFER_EXT, - rb_name); - /* Choose to render to the color attachment. */ - _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0_EXT); - - _mesa_DepthMask(GL_FALSE); - _mesa_ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE); - - _mesa_ActiveTextureARB(GL_TEXTURE0_ARB); - _mesa_Enable(GL_TEXTURE_2D); - _mesa_GenTextures(1, &texname); - _mesa_BindTexture(GL_TEXTURE_2D, texname); - _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - _mesa_TexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - old_unpack = ctx->Unpack; - ctx->Unpack = ctx->DefaultPacking; - _mesa_TexImage2D(GL_TEXTURE_2D, 0, GL_INTENSITY, width, height, 0, - GL_RED, GL_UNSIGNED_BYTE, stencil_pixels); - ctx->Unpack = old_unpack; - free(stencil_pixels); - - meta_set_passthrough_transform(&intel->meta); - - /* Since we're rendering to the framebuffer as if it was an FBO, - * if it's the window system we have to flip the coordinates. - */ - if (rendering_to_fbo) { - y1 = y; - y2 = y + height * ctx->Pixel.ZoomY; - } else { - y1 = irb->Base.Height - (y + height * ctx->Pixel.ZoomY); - y2 = irb->Base.Height - y; - } - vertices[0][0] = x; - vertices[0][1] = y1; - vertices[1][0] = x + width * ctx->Pixel.ZoomX; - vertices[1][1] = y1; - vertices[2][0] = x + width * ctx->Pixel.ZoomX; - vertices[2][1] = y2; - vertices[3][0] = x; - vertices[3][1] = y2; - - _mesa_VertexPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), &vertices); - _mesa_Enable(GL_VERTEX_ARRAY); - meta_set_default_texrect(&intel->meta); - - _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); - - meta_restore_texcoords(&intel->meta); - meta_restore_transform(&intel->meta); - - _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + old_active_texture); - _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, old_fb_name); - - _mesa_PopClientAttrib(); - _mesa_PopAttrib(); - - _mesa_DeleteTextures(1, &texname); - _mesa_DeleteFramebuffersEXT(1, &fb_name); - _mesa_DeleteRenderbuffersEXT(1, &rb_name); - - return GL_TRUE; -} void -intelDrawPixels(GLcontext * ctx, +intelDrawPixels(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, @@ -255,24 +47,11 @@ intelDrawPixels(GLcontext * ctx, const struct gl_pixelstore_attrib *unpack, const GLvoid * pixels) { -#if 0 - /* XXX this function doesn't seem to work reliably even when all - * the pre-requisite conditions are met. - * Note that this function is never hit with conform. - * Fall back to swrast because even the _mesa_meta_DrawPixels() approach - * isn't working because of an apparent stencil bug. - */ - if (intel_stencil_drawpixels(ctx, x, y, width, height, format, type, - unpack, pixels)) - return; -#else - (void) intel_stencil_drawpixels; /* silence warning */ if (format == GL_STENCIL_INDEX) { _swrast_DrawPixels(ctx, x, y, width, height, format, type, unpack, pixels); return; } -#endif _mesa_meta_DrawPixels(ctx, x, y, width, height, format, type, unpack, pixels); diff --git a/src/mesa/drivers/dri/intel/intel_pixel_read.c b/src/mesa/drivers/dri/intel/intel_pixel_read.c index 21d2a7a93e..b249f9a5a0 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_read.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_read.c @@ -65,7 +65,7 @@ */ static GLboolean -do_blit_readpixels(GLcontext * ctx, +do_blit_readpixels(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *pack, GLvoid * pixels) @@ -165,7 +165,7 @@ do_blit_readpixels(GLcontext * ctx, } void -intelReadPixels(GLcontext * ctx, +intelReadPixels(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *pack, GLvoid * pixels) diff --git a/src/mesa/drivers/dri/intel/intel_reg.h b/src/mesa/drivers/dri/intel/intel_reg.h index c1a281f261..955b100b21 100644 --- a/src/mesa/drivers/dri/intel/intel_reg.h +++ b/src/mesa/drivers/dri/intel/intel_reg.h @@ -55,6 +55,11 @@ * additional flushing control. */ #define _3DSTATE_PIPE_CONTROL (CMD_3D | (3 << 27) | (2 << 24) | 2) +#define PIPE_CONTROL_CS_STALL (1 << 20) +#define PIPE_CONTROL_GLOBAL_SNAPSHOT_COUNT_RESET (1 << 19) +#define PIPE_CONTROL_TLB_INVALIDATE (1 << 18) +#define PIPE_CONTROL_SYNC_GFDT (1 << 17) +#define PIPE_CONTROL_MEDIA_STATE_CLEAR (1 << 16) #define PIPE_CONTROL_NO_WRITE (0 << 14) #define PIPE_CONTROL_WRITE_IMMEDIATE (1 << 14) #define PIPE_CONTROL_WRITE_DEPTH_COUNT (2 << 14) @@ -62,7 +67,14 @@ #define PIPE_CONTROL_DEPTH_STALL (1 << 13) #define PIPE_CONTROL_WRITE_FLUSH (1 << 12) #define PIPE_CONTROL_INSTRUCTION_FLUSH (1 << 11) +#define PIPE_CONTROL_TC_FLUSH (1 << 10) /* GM45+ only */ +#define PIPE_CONTROL_ISP_DIS (1 << 9) #define PIPE_CONTROL_INTERRUPT_ENABLE (1 << 8) +/* GT */ +#define PIPE_CONTROL_VF_CACHE_INVALIDATE (1 << 4) +#define PIPE_CONTROL_CONST_CACHE_INVALIDATE (1 << 3) +#define PIPE_CONTROL_STATE_CACHE_INVALIDATE (1 << 2) +#define PIPE_CONTROL_DEPTH_CACHE_FLUSH (1 << 0) #define PIPE_CONTROL_PPGTT_WRITE (0 << 2) #define PIPE_CONTROL_GLOBAL_GTT_WRITE (1 << 2) diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 0a542a7303..061f0d278d 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -123,12 +123,12 @@ static const struct __DRI2flushExtensionRec intelFlushExtension = { }; static __DRIimage * -intel_create_image_from_name(__DRIcontext *context, +intel_create_image_from_name(__DRIscreen *screen, int width, int height, int format, int name, int pitch, void *loaderPrivate) { + struct intel_screen *intelScreen = screen->private; __DRIimage *image; - struct intel_context *intel = context->driverPrivate; int cpp; image = CALLOC(sizeof *image); @@ -159,7 +159,7 @@ intel_create_image_from_name(__DRIcontext *context, image->data = loaderPrivate; cpp = _mesa_get_format_bytes(image->format); - image->region = intel_region_alloc_for_handle(intel->intelScreen, + image->region = intel_region_alloc_for_handle(intelScreen, cpp, width, height, pitch, name, "image"); if (image->region == NULL) { @@ -339,7 +339,7 @@ intelDestroyScreen(__DRIscreen * sPriv) static GLboolean intelCreateBuffer(__DRIscreen * driScrnPriv, __DRIdrawable * driDrawPriv, - const __GLcontextModes * mesaVis, GLboolean isPixmap) + const struct gl_config * mesaVis, GLboolean isPixmap) { struct intel_renderbuffer *rb; @@ -415,22 +415,22 @@ intelDestroyBuffer(__DRIdrawable * driDrawPriv) * init-designated function to register chipids and createcontext * functions. */ -extern GLboolean i830CreateContext(const __GLcontextModes * mesaVis, +extern GLboolean i830CreateContext(const struct gl_config * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate); extern GLboolean i915CreateContext(int api, - const __GLcontextModes * mesaVis, + const struct gl_config * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate); extern GLboolean brwCreateContext(int api, - const __GLcontextModes * mesaVis, + const struct gl_config * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate); static GLboolean intelCreateContext(gl_api api, - const __GLcontextModes * mesaVis, + const struct gl_config * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate) { @@ -465,7 +465,6 @@ intel_init_bufmgr(struct intel_screen *intelScreen) intelScreen->no_hw = getenv("INTEL_NO_HW") != NULL; intelScreen->bufmgr = intel_bufmgr_gem_init(spriv->fd, BATCH_SZ); - /* Otherwise, use the classic buffer manager. */ if (intelScreen->bufmgr == NULL) { fprintf(stderr, "[%s:%u] Error initializing buffer manager.\n", __func__, __LINE__); @@ -489,7 +488,7 @@ intel_init_bufmgr(struct intel_screen *intelScreen) * This is the driver specific part of the createNewScreen entry point. * Called when using DRI2. * - * \return the __GLcontextModes supported by this driver + * \return the struct gl_config supported by this driver */ static const __DRIconfig **intelInitScreen2(__DRIscreen *psp) diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index fb840c1020..104cadf0f9 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -246,7 +246,7 @@ intel_map_unmap_framebuffer(struct intel_context *intel, * Old note: Moved locking out to get reasonable span performance. */ void -intelSpanRenderStart(GLcontext * ctx) +intelSpanRenderStart(struct gl_context * ctx) { struct intel_context *intel = intel_context(ctx); GLuint i; @@ -273,7 +273,7 @@ intelSpanRenderStart(GLcontext * ctx) * the above function. */ void -intelSpanRenderFinish(GLcontext * ctx) +intelSpanRenderFinish(struct gl_context * ctx) { struct intel_context *intel = intel_context(ctx); GLuint i; @@ -294,7 +294,7 @@ intelSpanRenderFinish(GLcontext * ctx) void -intelInitSpanFuncs(GLcontext * ctx) +intelInitSpanFuncs(struct gl_context * ctx) { struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx); swdd->SpanRenderStart = intelSpanRenderStart; @@ -302,7 +302,7 @@ intelInitSpanFuncs(GLcontext * ctx) } void -intel_map_vertex_shader_textures(GLcontext *ctx) +intel_map_vertex_shader_textures(struct gl_context *ctx) { struct intel_context *intel = intel_context(ctx); int i; @@ -321,7 +321,7 @@ intel_map_vertex_shader_textures(GLcontext *ctx) } void -intel_unmap_vertex_shader_textures(GLcontext *ctx) +intel_unmap_vertex_shader_textures(struct gl_context *ctx) { struct intel_context *intel = intel_context(ctx); int i; @@ -366,6 +366,7 @@ intel_set_span_functions(struct intel_context *intel, intel_InitPointers_xRGB8888(rb); break; case MESA_FORMAT_ARGB8888: + case MESA_FORMAT_SARGB8: intel_InitPointers_ARGB8888(rb); break; case MESA_FORMAT_Z16: diff --git a/src/mesa/drivers/dri/intel/intel_span.h b/src/mesa/drivers/dri/intel/intel_span.h index bffe109aa5..aa8d08e843 100644 --- a/src/mesa/drivers/dri/intel/intel_span.h +++ b/src/mesa/drivers/dri/intel/intel_span.h @@ -28,15 +28,15 @@ #ifndef _INTEL_SPAN_H #define _INTEL_SPAN_H -extern void intelInitSpanFuncs(GLcontext * ctx); +extern void intelInitSpanFuncs(struct gl_context * ctx); -extern void intelSpanRenderFinish(GLcontext * ctx); -extern void intelSpanRenderStart(GLcontext * ctx); +extern void intelSpanRenderFinish(struct gl_context * ctx); +extern void intelSpanRenderStart(struct gl_context * ctx); void intel_renderbuffer_map(struct intel_context *intel, struct gl_renderbuffer *rb); void intel_renderbuffer_unmap(struct intel_context *intel, struct gl_renderbuffer *rb); -void intel_map_vertex_shader_textures(GLcontext *ctx); -void intel_unmap_vertex_shader_textures(GLcontext *ctx); +void intel_map_vertex_shader_textures(struct gl_context *ctx); +void intel_unmap_vertex_shader_textures(struct gl_context *ctx); #endif diff --git a/src/mesa/drivers/dri/intel/intel_state.c b/src/mesa/drivers/dri/intel/intel_state.c index c5ef909dbf..80598b7ef6 100644 --- a/src/mesa/drivers/dri/intel/intel_state.c +++ b/src/mesa/drivers/dri/intel/intel_state.c @@ -197,7 +197,7 @@ intel_translate_logic_op(GLenum opcode) /* Fallback to swrast for select and feedback. */ static void -intelRenderMode(GLcontext *ctx, GLenum mode) +intelRenderMode(struct gl_context *ctx, GLenum mode) { struct intel_context *intel = intel_context(ctx); FALLBACK(intel, INTEL_FALLBACK_RENDERMODE, (mode != GL_RENDER)); diff --git a/src/mesa/drivers/dri/intel/intel_syncobj.c b/src/mesa/drivers/dri/intel/intel_syncobj.c index c2d86432ff..bbfac74b60 100644 --- a/src/mesa/drivers/dri/intel/intel_syncobj.c +++ b/src/mesa/drivers/dri/intel/intel_syncobj.c @@ -46,7 +46,7 @@ #include "intel_reg.h" static struct gl_sync_object * -intel_new_sync_object(GLcontext *ctx, GLuint id) +intel_new_sync_object(struct gl_context *ctx, GLuint id) { struct intel_sync_object *sync; @@ -56,7 +56,7 @@ intel_new_sync_object(GLcontext *ctx, GLuint id) } static void -intel_delete_sync_object(GLcontext *ctx, struct gl_sync_object *s) +intel_delete_sync_object(struct gl_context *ctx, struct gl_sync_object *s) { struct intel_sync_object *sync = (struct intel_sync_object *)s; @@ -65,7 +65,7 @@ intel_delete_sync_object(GLcontext *ctx, struct gl_sync_object *s) } static void -intel_fence_sync(GLcontext *ctx, struct gl_sync_object *s, +intel_fence_sync(struct gl_context *ctx, struct gl_sync_object *s, GLenum condition, GLbitfield flags) { struct intel_context *intel = intel_context(ctx); @@ -87,7 +87,7 @@ intel_fence_sync(GLcontext *ctx, struct gl_sync_object *s, * The fix would be a new kernel function to do the GTT transition with a * timeout. */ -static void intel_client_wait_sync(GLcontext *ctx, struct gl_sync_object *s, +static void intel_client_wait_sync(struct gl_context *ctx, struct gl_sync_object *s, GLbitfield flags, GLuint64 timeout) { struct intel_sync_object *sync = (struct intel_sync_object *)s; @@ -105,12 +105,12 @@ static void intel_client_wait_sync(GLcontext *ctx, struct gl_sync_object *s, * any batchbuffers coming after this waitsync will naturally not occur until * the previous one is done. */ -static void intel_server_wait_sync(GLcontext *ctx, struct gl_sync_object *s, +static void intel_server_wait_sync(struct gl_context *ctx, struct gl_sync_object *s, GLbitfield flags, GLuint64 timeout) { } -static void intel_check_sync(GLcontext *ctx, struct gl_sync_object *s) +static void intel_check_sync(struct gl_context *ctx, struct gl_sync_object *s) { struct intel_sync_object *sync = (struct intel_sync_object *)s; diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c index 8bb6ae99fb..3d9a2549db 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.c +++ b/src/mesa/drivers/dri/intel/intel_tex.c @@ -9,25 +9,8 @@ #define FILE_DEBUG_FLAG DEBUG_TEXTURE -static GLboolean -intelIsTextureResident(GLcontext * ctx, struct gl_texture_object *texObj) -{ -#if 0 - struct intel_context *intel = intel_context(ctx); - struct intel_texture_object *intelObj = intel_texture_object(texObj); - - return - intelObj->mt && - intelObj->mt->region && - intel_is_region_resident(intel, intelObj->mt->region); -#endif - return 1; -} - - - static struct gl_texture_image * -intelNewTextureImage(GLcontext * ctx) +intelNewTextureImage(struct gl_context * ctx) { DBG("%s\n", __FUNCTION__); (void) ctx; @@ -36,7 +19,7 @@ intelNewTextureImage(GLcontext * ctx) static struct gl_texture_object * -intelNewTextureObject(GLcontext * ctx, GLuint name, GLenum target) +intelNewTextureObject(struct gl_context * ctx, GLuint name, GLenum target) { struct intel_texture_object *obj = CALLOC_STRUCT(intel_texture_object); @@ -47,7 +30,7 @@ intelNewTextureObject(GLcontext * ctx, GLuint name, GLenum target) } static void -intelDeleteTextureObject(GLcontext *ctx, +intelDeleteTextureObject(struct gl_context *ctx, struct gl_texture_object *texObj) { struct intel_context *intel = intel_context(ctx); @@ -61,7 +44,7 @@ intelDeleteTextureObject(GLcontext *ctx, static void -intelFreeTextureImageData(GLcontext * ctx, struct gl_texture_image *texImage) +intelFreeTextureImageData(struct gl_context * ctx, struct gl_texture_image *texImage) { struct intel_context *intel = intel_context(ctx); struct intel_texture_image *intelImage = intel_texture_image(texImage); @@ -167,13 +150,17 @@ timed_memcpy(void *dest, const void *src, size_t n) * map/unmap the base level texture image. */ static void -intelGenerateMipmap(GLcontext *ctx, GLenum target, +intelGenerateMipmap(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj) { if (_mesa_meta_check_generate_mipmap_fallback(ctx, target, texObj)) { /* sw path: need to map texture images */ struct intel_context *intel = intel_context(ctx); struct intel_texture_object *intelObj = intel_texture_object(texObj); + + if (INTEL_DEBUG & DEBUG_FALLBACKS) + fprintf(stderr, "%s - fallback to swrast\n", __FUNCTION__); + intel_tex_map_level_images(intel, intelObj, texObj->BaseLevel); _mesa_generate_mipmap(ctx, target, texObj); intel_tex_unmap_level_images(intel, intelObj, texObj->BaseLevel); @@ -216,8 +203,6 @@ intelInitTextureFuncs(struct dd_function_table *functions) functions->NewTextureImage = intelNewTextureImage; functions->DeleteTexture = intelDeleteTextureObject; functions->FreeTexImageData = intelFreeTextureImageData; - functions->UpdateTexturePalette = 0; - functions->IsTextureResident = intelIsTextureResident; #if DO_DEBUG && !defined(__ia64__) if (INTEL_DEBUG & DEBUG_BUFMGR) diff --git a/src/mesa/drivers/dri/intel/intel_tex.h b/src/mesa/drivers/dri/intel/intel_tex.h index cd77dd5b8e..7906554e45 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.h +++ b/src/mesa/drivers/dri/intel/intel_tex.h @@ -40,7 +40,7 @@ void intelInitTextureSubImageFuncs(struct dd_function_table *functions); void intelInitTextureCopyImageFuncs(struct dd_function_table *functions); -gl_format intelChooseTextureFormat(GLcontext *ctx, GLint internalFormat, +gl_format intelChooseTextureFormat(struct gl_context *ctx, GLint internalFormat, GLenum format, GLenum type); void intelSetTexBuffer(__DRIcontext *pDRICtx, diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index 6efb2ddc55..2d046fd52d 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -72,6 +72,7 @@ get_teximage_source(struct intel_context *intel, GLenum internalFormat) if (irb && irb->region && irb->region->cpp == 4) return irb->region; return NULL; + case 4: case GL_RGBA: case GL_RGBA8: irb = intel_renderbuffer(intel->ctx.ReadBuffer->_ColorReadBuffer); @@ -82,6 +83,7 @@ get_teximage_source(struct intel_context *intel, GLenum internalFormat) if (irb->Base._BaseFormat == GL_RGB) return NULL; return irb->region; + case 3: case GL_RGB: case GL_RGB8: return intel_readbuf_region(intel); @@ -99,7 +101,7 @@ do_copy_texsubimage(struct intel_context *intel, GLint dstx, GLint dsty, GLint x, GLint y, GLsizei width, GLsizei height) { - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; const struct intel_region *src = get_teximage_source(intel, internalFormat); if (!intelImage->mt || !src || !src->buffer) { @@ -170,7 +172,7 @@ do_copy_texsubimage(struct intel_context *intel, static void -intelCopyTexImage1D(GLcontext * ctx, GLenum target, GLint level, +intelCopyTexImage1D(struct gl_context * ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border) { @@ -218,7 +220,7 @@ intelCopyTexImage1D(GLcontext * ctx, GLenum target, GLint level, static void -intelCopyTexImage2D(GLcontext * ctx, GLenum target, GLint level, +intelCopyTexImage2D(struct gl_context * ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) @@ -267,7 +269,7 @@ intelCopyTexImage2D(GLcontext * ctx, GLenum target, GLint level, static void -intelCopyTexSubImage1D(GLcontext * ctx, GLenum target, GLint level, +intelCopyTexSubImage1D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) { struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx); @@ -293,7 +295,7 @@ intelCopyTexSubImage1D(GLcontext * ctx, GLenum target, GLint level, static void -intelCopyTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, +intelCopyTexSubImage2D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { diff --git a/src/mesa/drivers/dri/intel/intel_tex_format.c b/src/mesa/drivers/dri/intel/intel_tex_format.c index e03b203fb4..9d73a2fb37 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_format.c +++ b/src/mesa/drivers/dri/intel/intel_tex_format.c @@ -15,7 +15,7 @@ * immediately after sampling... */ gl_format -intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, +intelChooseTextureFormat(struct gl_context * ctx, GLint internalFormat, GLenum format, GLenum type) { struct intel_context *intel = intel_context(ctx); @@ -93,6 +93,10 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, case GL_LUMINANCE12_ALPHA4: case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: + /* i915 could implement this mode using MT_32BIT_RG1616. However, this + * would require an extra swizzle instruction in the fragment shader to + * convert the { R, G, 1.0, 1.0 } to { R, R, R, G }. + */ #ifndef I915 return MESA_FORMAT_AL1616; #else @@ -193,6 +197,22 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, case GL_RGBA_SNORM: case GL_RGBA8_SNORM: return MESA_FORMAT_SIGNED_RGBA8888_REV; + + /* i915 can do a RG16, but it can't do any of the other RED or RG formats. + * In addition, it only implements the broken D3D mode where undefined + * components are read as 1.0. I'm not sure who thought reading + * { R, G, 1.0, 1.0 } from a red-green texture would be useful. + */ + case GL_RED: + case GL_R8: + return MESA_FORMAT_R8; + case GL_R16: + return MESA_FORMAT_R16; + case GL_RG: + case GL_RG8: + return MESA_FORMAT_RG88; + case GL_RG16: + return MESA_FORMAT_RG1616; #endif default: diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 7d33df3599..35f3d7d382 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -4,14 +4,12 @@ #include "main/mtypes.h" #include "main/enums.h" #include "main/bufferobj.h" -#include "main/convolve.h" #include "main/context.h" #include "main/formats.h" #include "main/texcompress.h" #include "main/texstore.h" #include "main/texgetimage.h" #include "main/texobj.h" -#include "main/texstore.h" #include "main/teximage.h" #include "intel_context.h" @@ -74,10 +72,7 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel, DBG("%s\n", __FUNCTION__); - if (intelImage->base.Border || - ((intelImage->base._BaseFormat == GL_DEPTH_COMPONENT) && - ((intelObj->base.WrapS == GL_CLAMP_TO_BORDER) || - (intelObj->base.WrapT == GL_CLAMP_TO_BORDER)))) + if (intelImage->base.Border) return; if (intelImage->level > intelObj->base.BaseLevel && @@ -305,7 +300,7 @@ try_pbo_zcopy(struct intel_context *intel, static void -intelTexImage(GLcontext * ctx, +intelTexImage(struct gl_context * ctx, GLint dims, GLenum target, GLint level, GLint internalFormat, @@ -320,8 +315,6 @@ intelTexImage(GLcontext * ctx, struct intel_context *intel = intel_context(ctx); struct intel_texture_object *intelObj = intel_texture_object(texObj); struct intel_texture_image *intelImage = intel_texture_image(texImage); - GLint postConvWidth = width; - GLint postConvHeight = height; GLint texelBytes, sizeInBytes; GLuint dstRowStride = 0, srcRowStride = texImage->RowStride; @@ -331,25 +324,14 @@ intelTexImage(GLcontext * ctx, intelImage->face = target_to_face(target); intelImage->level = level; - if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) { - _mesa_adjust_image_for_convolution(ctx, dims, &postConvWidth, - &postConvHeight); - } - if (_mesa_is_format_compressed(texImage->TexFormat)) { texelBytes = 0; } else { texelBytes = _mesa_get_format_bytes(texImage->TexFormat); - - /* Minimum pitch of 32 bytes */ - if (postConvWidth * texelBytes < 32) { - postConvWidth = 32 / texelBytes; - texImage->RowStride = postConvWidth; - } if (!intelImage->mt) { - assert(texImage->RowStride == postConvWidth); + assert(texImage->RowStride == width); } } @@ -502,8 +484,8 @@ intelTexImage(GLcontext * ctx, assert(dims != 3); } else { - dstRowStride = postConvWidth * texelBytes; - sizeInBytes = depth * dstRowStride * postConvHeight; + dstRowStride = width * texelBytes; + sizeInBytes = depth * dstRowStride * height; } texImage->Data = _mesa_alloc_texmemory(sizeInBytes); @@ -557,7 +539,7 @@ intelTexImage(GLcontext * ctx, static void -intelTexImage3D(GLcontext * ctx, +intelTexImage3D(struct gl_context * ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint depth, @@ -574,7 +556,7 @@ intelTexImage3D(GLcontext * ctx, static void -intelTexImage2D(GLcontext * ctx, +intelTexImage2D(struct gl_context * ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, @@ -590,7 +572,7 @@ intelTexImage2D(GLcontext * ctx, static void -intelTexImage1D(GLcontext * ctx, +intelTexImage1D(struct gl_context * ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, @@ -606,7 +588,7 @@ intelTexImage1D(GLcontext * ctx, static void -intelCompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level, +intelCompressedTexImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLsizei imageSize, const GLvoid *data, @@ -624,7 +606,7 @@ intelCompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level, * then unmap it. */ static void -intel_get_tex_image(GLcontext * ctx, GLenum target, GLint level, +intel_get_tex_image(struct gl_context * ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels, struct gl_texture_object *texObj, struct gl_texture_image *texImage, GLboolean compressed) @@ -684,7 +666,7 @@ intel_get_tex_image(GLcontext * ctx, GLenum target, GLint level, static void -intelGetTexImage(GLcontext * ctx, GLenum target, GLint level, +intelGetTexImage(struct gl_context * ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels, struct gl_texture_object *texObj, struct gl_texture_image *texImage) @@ -695,7 +677,7 @@ intelGetTexImage(GLcontext * ctx, GLenum target, GLint level, static void -intelGetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level, +intelGetCompressedTexImage(struct gl_context *ctx, GLenum target, GLint level, GLvoid *pixels, struct gl_texture_object *texObj, struct gl_texture_image *texImage) @@ -711,7 +693,7 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, { struct gl_framebuffer *fb = dPriv->driverPrivate; struct intel_context *intel = pDRICtx->driverPrivate; - GLcontext *ctx = &intel->ctx; + struct gl_context *ctx = &intel->ctx; struct intel_texture_object *intelObj; struct intel_texture_image *intelImage; struct intel_mipmap_tree *mt; @@ -792,7 +774,7 @@ intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv) #if FEATURE_OES_EGL_image static void -intel_image_target_texture_2d(GLcontext *ctx, GLenum target, +intel_image_target_texture_2d(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj, struct gl_texture_image *texImage, GLeglImageOES image_handle) @@ -805,8 +787,8 @@ intel_image_target_texture_2d(GLcontext *ctx, GLenum target, __DRIimage *image; screen = intel->intelScreen->driScrnPriv; - image = screen->dri2.image->lookupEGLImage(intel->driContext, image_handle, - intel->driContext->loaderPrivate); + image = screen->dri2.image->lookupEGLImage(screen, image_handle, + screen->loaderPrivate); if (image == NULL) return; diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c index b7ce50a820..c9b992a21b 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c +++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c @@ -40,7 +40,7 @@ #define FILE_DEBUG_FLAG DEBUG_TEXTURE static void -intelTexSubimage(GLcontext * ctx, +intelTexSubimage(struct gl_context * ctx, GLint dims, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, @@ -189,7 +189,7 @@ intelTexSubimage(GLcontext * ctx, static void -intelTexSubImage3D(GLcontext * ctx, +intelTexSubImage3D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, @@ -209,7 +209,7 @@ intelTexSubImage3D(GLcontext * ctx, static void -intelTexSubImage2D(GLcontext * ctx, +intelTexSubImage2D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -229,7 +229,7 @@ intelTexSubImage2D(GLcontext * ctx, static void -intelTexSubImage1D(GLcontext * ctx, +intelTexSubImage1D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, @@ -248,7 +248,7 @@ intelTexSubImage1D(GLcontext * ctx, } static void -intelCompressedTexSubImage2D(GLcontext * ctx, +intelCompressedTexSubImage2D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, diff --git a/src/mesa/drivers/dri/mach64/mach64_context.c b/src/mesa/drivers/dri/mach64/mach64_context.c index 72a44d9642..7c989df5ec 100644 --- a/src/mesa/drivers/dri/mach64/mach64_context.c +++ b/src/mesa/drivers/dri/mach64/mach64_context.c @@ -79,7 +79,6 @@ static const struct dri_extension card_extensions[] = { "GL_ARB_multitexture", NULL }, { "GL_EXT_texture_edge_clamp", NULL }, { "GL_MESA_ycbcr_texture", NULL }, - { "GL_SGIS_generate_mipmap", NULL }, { NULL, NULL } }; @@ -87,11 +86,11 @@ static const struct dri_extension card_extensions[] = /* Create the device specific context. */ GLboolean mach64CreateContext( gl_api api, - const __GLcontextModes *glVisual, + const struct gl_config *glVisual, __DRIcontext *driContextPriv, void *sharedContextPrivate ) { - GLcontext *ctx, *shareCtx; + struct gl_context *ctx, *shareCtx; __DRIscreen *driScreen = driContextPriv->driScreenPriv; struct dd_function_table functions; mach64ContextPtr mmesa; @@ -335,8 +334,8 @@ mach64MakeCurrent( __DRIcontext *driContextPriv, } _mesa_make_current( newMach64Ctx->glCtx, - (GLframebuffer *) driDrawPriv->driverPrivate, - (GLframebuffer *) driReadPriv->driverPrivate ); + (struct gl_framebuffer *) driDrawPriv->driverPrivate, + (struct gl_framebuffer *) driReadPriv->driverPrivate ); newMach64Ctx->new_state |= MACH64_NEW_CLIP; diff --git a/src/mesa/drivers/dri/mach64/mach64_context.h b/src/mesa/drivers/dri/mach64/mach64_context.h index 893fc8daee..11e8f53b28 100644 --- a/src/mesa/drivers/dri/mach64/mach64_context.h +++ b/src/mesa/drivers/dri/mach64/mach64_context.h @@ -161,7 +161,7 @@ struct mach64_texture_object { typedef struct mach64_texture_object mach64TexObj, *mach64TexObjPtr; struct mach64_context { - GLcontext *glCtx; + struct gl_context *glCtx; /* Driver and hardware state management */ @@ -274,7 +274,7 @@ struct mach64_context { extern GLboolean mach64CreateContext( gl_api api, - const __GLcontextModes *glVisual, + const struct gl_config *glVisual, __DRIcontext *driContextPriv, void *sharedContextPrivate ); diff --git a/src/mesa/drivers/dri/mach64/mach64_dd.c b/src/mesa/drivers/dri/mach64/mach64_dd.c index ca713e2de5..9cb2c10759 100644 --- a/src/mesa/drivers/dri/mach64/mach64_dd.c +++ b/src/mesa/drivers/dri/mach64/mach64_dd.c @@ -41,7 +41,7 @@ /* Return the current color buffer size. */ -static void mach64DDGetBufferSize( GLframebuffer *buffer, +static void mach64DDGetBufferSize( struct gl_framebuffer *buffer, GLuint *width, GLuint *height ) { GET_CURRENT_CONTEXT(ctx); @@ -55,7 +55,7 @@ static void mach64DDGetBufferSize( GLframebuffer *buffer, /* Return various strings for glGetString(). */ -static const GLubyte *mach64DDGetString( GLcontext *ctx, GLenum name ) +static const GLubyte *mach64DDGetString( struct gl_context *ctx, GLenum name ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); static char buffer[128]; @@ -84,7 +84,7 @@ static const GLubyte *mach64DDGetString( GLcontext *ctx, GLenum name ) * hardware. All commands that are normally sent to the ring are * already considered `flushed'. */ -static void mach64DDFlush( GLcontext *ctx ) +static void mach64DDFlush( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -107,7 +107,7 @@ static void mach64DDFlush( GLcontext *ctx ) /* Make sure all commands have been sent to the hardware and have * completed processing. */ -static void mach64DDFinish( GLcontext *ctx ) +static void mach64DDFinish( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/mach64/mach64_ioctl.c b/src/mesa/drivers/dri/mach64/mach64_ioctl.c index 03587c44fd..0146e0d051 100644 --- a/src/mesa/drivers/dri/mach64/mach64_ioctl.c +++ b/src/mesa/drivers/dri/mach64/mach64_ioctl.c @@ -665,7 +665,7 @@ void mach64PerformanceBoxesLocked( mach64ContextPtr mmesa ) * Buffer clear */ -static void mach64DDClear( GLcontext *ctx, GLbitfield mask ) +static void mach64DDClear( struct gl_context *ctx, GLbitfield mask ) { mach64ContextPtr mmesa = MACH64_CONTEXT( ctx ); __DRIdrawable *dPriv = mmesa->driDrawable; diff --git a/src/mesa/drivers/dri/mach64/mach64_native_vb.c b/src/mesa/drivers/dri/mach64/mach64_native_vb.c index 816682ec5f..d8426ddee1 100644 --- a/src/mesa/drivers/dri/mach64/mach64_native_vb.c +++ b/src/mesa/drivers/dri/mach64/mach64_native_vb.c @@ -35,7 +35,7 @@ #define LOCALVARS #endif -void TAG(translate_vertex)(GLcontext *ctx, +void TAG(translate_vertex)(struct gl_context *ctx, const VERTEX *src, SWvertex *dst) { @@ -108,7 +108,7 @@ void TAG(translate_vertex)(GLcontext *ctx, -void TAG(print_vertex)( GLcontext *ctx, const VERTEX *v ) +void TAG(print_vertex)( struct gl_context *ctx, const VERTEX *v ) { LOCALVARS GLuint format = GET_VERTEX_FORMAT(); @@ -199,7 +199,7 @@ void TAG(print_vertex)( GLcontext *ctx, const VERTEX *v ) #define GET_COLOR(ptr, idx) ((ptr)->data[idx]) -INTERP_QUALIFIER void TAG(interp_extras)( GLcontext *ctx, +INTERP_QUALIFIER void TAG(interp_extras)( struct gl_context *ctx, GLfloat t, GLuint dst, GLuint out, GLuint in, GLboolean force_boundary ) @@ -230,7 +230,7 @@ INTERP_QUALIFIER void TAG(interp_extras)( GLcontext *ctx, INTERP_VERTEX(ctx, t, dst, out, in, force_boundary); } -INTERP_QUALIFIER void TAG(copy_pv_extras)( GLcontext *ctx, +INTERP_QUALIFIER void TAG(copy_pv_extras)( struct gl_context *ctx, GLuint dst, GLuint src ) { LOCALVARS diff --git a/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h b/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h index 6e5fa3520e..8345f5cdbc 100644 --- a/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h +++ b/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h @@ -52,7 +52,7 @@ #define LOCALVARS #endif -static void TAG(emit)( GLcontext *ctx, +static void TAG(emit)( struct gl_context *ctx, GLuint start, GLuint end, void *dest, GLuint stride ) @@ -312,7 +312,7 @@ static void TAG(emit)( GLcontext *ctx, #if DO_XYZW && DO_RGBA -static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) +static GLboolean TAG(check_tex_sizes)( struct gl_context *ctx ) { LOCALVARS struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; @@ -344,7 +344,7 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) } -static void TAG(interp)( GLcontext *ctx, +static void TAG(interp)( struct gl_context *ctx, GLfloat t, GLuint edst, GLuint eout, GLuint ein, GLboolean force_boundary ) @@ -511,7 +511,7 @@ static void TAG(interp)( GLcontext *ctx, #endif /* DO_RGBA && DO_XYZW */ -static void TAG(copy_pv)( GLcontext *ctx, GLuint edst, GLuint esrc ) +static void TAG(copy_pv)( struct gl_context *ctx, GLuint edst, GLuint esrc ) { #if DO_SPEC || DO_FOG || DO_RGBA LOCALVARS diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index 239e8bc8fd..956bccbcd6 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -71,7 +71,7 @@ mach64FillInModes( __DRIscreen *psp, unsigned stencil_bits, GLboolean have_back_buffer ) { __DRIconfig **configs; - __GLcontextModes * m; + struct gl_config * m; GLenum fb_format; GLenum fb_type; unsigned depth_buffer_factor; @@ -298,7 +298,7 @@ mach64DestroyScreen( __DRIscreen *driScreen ) static GLboolean mach64CreateBuffer( __DRIscreen *driScrnPriv, __DRIdrawable *driDrawPriv, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, GLboolean isPixmap ) { mach64ScreenPtr screen = (mach64ScreenPtr) driScrnPriv->private; @@ -369,7 +369,7 @@ mach64CreateBuffer( __DRIscreen *driScrnPriv, static void mach64DestroyBuffer(__DRIdrawable *driDrawPriv) { - _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL); + _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL); } @@ -379,7 +379,7 @@ mach64SwapBuffers(__DRIdrawable *dPriv) { if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) { mach64ContextPtr mmesa; - GLcontext *ctx; + struct gl_context *ctx; mmesa = (mach64ContextPtr) dPriv->driContextPriv->driverPrivate; ctx = mmesa->glCtx; if (ctx->Visual.doubleBufferMode) { @@ -414,7 +414,7 @@ mach64InitDriver( __DRIscreen *driScreen ) * * \todo maybe fold this into intelInitDriver * - * \return the __GLcontextModes supported by this driver + * \return the struct gl_config supported by this driver */ static const __DRIconfig ** mach64InitScreen(__DRIscreen *psp) diff --git a/src/mesa/drivers/dri/mach64/mach64_span.c b/src/mesa/drivers/dri/mach64/mach64_span.c index 0c52c0c88c..4b853c2af3 100644 --- a/src/mesa/drivers/dri/mach64/mach64_span.c +++ b/src/mesa/drivers/dri/mach64/mach64_span.c @@ -128,21 +128,21 @@ #include "depthtmp.h" -static void mach64SpanRenderStart( GLcontext *ctx ) +static void mach64SpanRenderStart( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); LOCK_HARDWARE( mmesa ); FINISH_DMA_LOCKED( mmesa ); } -static void mach64SpanRenderFinish( GLcontext *ctx ) +static void mach64SpanRenderFinish( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); _swrast_flush( ctx ); UNLOCK_HARDWARE( mmesa ); } -void mach64DDInitSpanFuncs( GLcontext *ctx ) +void mach64DDInitSpanFuncs( struct gl_context *ctx ) { struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx); swdd->SpanRenderStart = mach64SpanRenderStart; @@ -154,7 +154,7 @@ void mach64DDInitSpanFuncs( GLcontext *ctx ) * Plug in the Get/Put routines for the given driRenderbuffer. */ void -mach64SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis) +mach64SetSpanFunctions(driRenderbuffer *drb, const struct gl_config *vis) { if (drb->Base.Format == MESA_FORMAT_RGB565) { mach64InitPointers_RGB565(&drb->Base); diff --git a/src/mesa/drivers/dri/mach64/mach64_span.h b/src/mesa/drivers/dri/mach64/mach64_span.h index 65141d05c3..2742e93c8e 100644 --- a/src/mesa/drivers/dri/mach64/mach64_span.h +++ b/src/mesa/drivers/dri/mach64/mach64_span.h @@ -33,9 +33,9 @@ #include "drirenderbuffer.h" -extern void mach64DDInitSpanFuncs( GLcontext *ctx ); +extern void mach64DDInitSpanFuncs( struct gl_context *ctx ); extern void -mach64SetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis); +mach64SetSpanFunctions(driRenderbuffer *rb, const struct gl_config *vis); #endif diff --git a/src/mesa/drivers/dri/mach64/mach64_state.c b/src/mesa/drivers/dri/mach64/mach64_state.c index 69a5aea02c..8e795955c2 100644 --- a/src/mesa/drivers/dri/mach64/mach64_state.c +++ b/src/mesa/drivers/dri/mach64/mach64_state.c @@ -48,7 +48,7 @@ * Alpha blending */ -static void mach64UpdateAlphaMode( GLcontext *ctx ) +static void mach64UpdateAlphaMode( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); GLuint a = mmesa->setup.alpha_tst_cntl; @@ -185,7 +185,7 @@ static void mach64UpdateAlphaMode( GLcontext *ctx ) } } -static void mach64DDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) +static void mach64DDAlphaFunc( struct gl_context *ctx, GLenum func, GLfloat ref ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -193,7 +193,7 @@ static void mach64DDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) mmesa->new_state |= MACH64_NEW_ALPHA; } -static void mach64DDBlendEquationSeparate( GLcontext *ctx, +static void mach64DDBlendEquationSeparate( struct gl_context *ctx, GLenum modeRGB, GLenum modeA ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -214,7 +214,7 @@ static void mach64DDBlendEquationSeparate( GLcontext *ctx, mmesa->new_state |= MACH64_NEW_ALPHA; } -static void mach64DDBlendFuncSeparate( GLcontext *ctx, +static void mach64DDBlendFuncSeparate( struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) { @@ -229,7 +229,7 @@ static void mach64DDBlendFuncSeparate( GLcontext *ctx, * Depth testing */ -static void mach64UpdateZMode( GLcontext *ctx ) +static void mach64UpdateZMode( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); GLuint z = mmesa->setup.z_cntl; @@ -285,7 +285,7 @@ static void mach64UpdateZMode( GLcontext *ctx ) } } -static void mach64DDDepthFunc( GLcontext *ctx, GLenum func ) +static void mach64DDDepthFunc( struct gl_context *ctx, GLenum func ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -293,7 +293,7 @@ static void mach64DDDepthFunc( GLcontext *ctx, GLenum func ) mmesa->new_state |= MACH64_NEW_DEPTH; } -static void mach64DDDepthMask( GLcontext *ctx, GLboolean flag ) +static void mach64DDDepthMask( struct gl_context *ctx, GLboolean flag ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -301,7 +301,7 @@ static void mach64DDDepthMask( GLcontext *ctx, GLboolean flag ) mmesa->new_state |= MACH64_NEW_DEPTH; } -static void mach64DDClearDepth( GLcontext *ctx, GLclampd d ) +static void mach64DDClearDepth( struct gl_context *ctx, GLclampd d ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -315,7 +315,7 @@ static void mach64DDClearDepth( GLcontext *ctx, GLclampd d ) * Fog */ -static void mach64UpdateFogAttrib( GLcontext *ctx ) +static void mach64UpdateFogAttrib( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -366,7 +366,7 @@ static void mach64UpdateFogAttrib( GLcontext *ctx ) } -static void mach64DDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) +static void mach64DDFogfv( struct gl_context *ctx, GLenum pname, const GLfloat *param ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -379,7 +379,7 @@ static void mach64DDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) * Clipping */ -static void mach64UpdateClipping( GLcontext *ctx ) +static void mach64UpdateClipping( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); mach64ScreenPtr mach64Screen = mmesa->mach64Screen; @@ -452,7 +452,7 @@ static void mach64UpdateClipping( GLcontext *ctx ) } } -static void mach64DDScissor( GLcontext *ctx, +static void mach64DDScissor( struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -466,7 +466,7 @@ static void mach64DDScissor( GLcontext *ctx, * Culling */ -static void mach64UpdateCull( GLcontext *ctx ) +static void mach64UpdateCull( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); GLfloat backface_sign = 1; @@ -495,7 +495,7 @@ static void mach64UpdateCull( GLcontext *ctx ) } -static void mach64DDCullFace( GLcontext *ctx, GLenum mode ) +static void mach64DDCullFace( struct gl_context *ctx, GLenum mode ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -503,7 +503,7 @@ static void mach64DDCullFace( GLcontext *ctx, GLenum mode ) mmesa->new_state |= MACH64_NEW_CULL; } -static void mach64DDFrontFace( GLcontext *ctx, GLenum mode ) +static void mach64DDFrontFace( struct gl_context *ctx, GLenum mode ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -516,7 +516,7 @@ static void mach64DDFrontFace( GLcontext *ctx, GLenum mode ) * Masks */ -static void mach64UpdateMasks( GLcontext *ctx ) +static void mach64UpdateMasks( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); GLuint mask = 0xffffffff; @@ -536,7 +536,7 @@ static void mach64UpdateMasks( GLcontext *ctx ) } } -static void mach64DDColorMask( GLcontext *ctx, +static void mach64DDColorMask( struct gl_context *ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) { @@ -555,7 +555,7 @@ static void mach64DDColorMask( GLcontext *ctx, * sense to break them out of the core texture state update routines. */ -static void mach64UpdateSpecularLighting( GLcontext *ctx ) +static void mach64UpdateSpecularLighting( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); GLuint a = mmesa->setup.alpha_tst_cntl; @@ -578,7 +578,7 @@ static void mach64UpdateSpecularLighting( GLcontext *ctx ) } } -static void mach64DDLightModelfv( GLcontext *ctx, GLenum pname, +static void mach64DDLightModelfv( struct gl_context *ctx, GLenum pname, const GLfloat *param ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -589,7 +589,7 @@ static void mach64DDLightModelfv( GLcontext *ctx, GLenum pname, } } -static void mach64DDShadeModel( GLcontext *ctx, GLenum mode ) +static void mach64DDShadeModel( struct gl_context *ctx, GLenum mode ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); GLuint s = mmesa->setup.setup_cntl; @@ -621,7 +621,7 @@ static void mach64DDShadeModel( GLcontext *ctx, GLenum mode ) */ -void mach64CalcViewport( GLcontext *ctx ) +void mach64CalcViewport( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); const GLfloat *v = ctx->Viewport._WindowMap.m; @@ -639,14 +639,14 @@ void mach64CalcViewport( GLcontext *ctx ) mmesa->SetupNewInputs = ~0; } -static void mach64Viewport( GLcontext *ctx, +static void mach64Viewport( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) { mach64CalcViewport( ctx ); } -static void mach64DepthRange( GLcontext *ctx, +static void mach64DepthRange( struct gl_context *ctx, GLclampd nearval, GLclampd farval ) { mach64CalcViewport( ctx ); @@ -657,7 +657,7 @@ static void mach64DepthRange( GLcontext *ctx, * Miscellaneous */ -static void mach64DDClearColor( GLcontext *ctx, +static void mach64DDClearColor( struct gl_context *ctx, const GLfloat color[4] ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -672,7 +672,7 @@ static void mach64DDClearColor( GLcontext *ctx, c[0], c[1], c[2], c[3] ); } -static void mach64DDLogicOpCode( GLcontext *ctx, GLenum opcode ) +static void mach64DDLogicOpCode( struct gl_context *ctx, GLenum opcode ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -683,7 +683,7 @@ static void mach64DDLogicOpCode( GLcontext *ctx, GLenum opcode ) } } -void mach64SetCliprects( GLcontext *ctx, GLenum mode ) +void mach64SetCliprects( struct gl_context *ctx, GLenum mode ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); __DRIdrawable *dPriv = mmesa->driDrawable; @@ -717,7 +717,7 @@ void mach64SetCliprects( GLcontext *ctx, GLenum mode ) mmesa->dirty |= MACH64_UPLOAD_CLIPRECTS; } -static void mach64DDDrawBuffer( GLcontext *ctx, GLenum mode ) +static void mach64DDDrawBuffer( struct gl_context *ctx, GLenum mode ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -755,7 +755,7 @@ static void mach64DDDrawBuffer( GLcontext *ctx, GLenum mode ) mmesa->dirty |= MACH64_UPLOAD_DST_OFF_PITCH; } -static void mach64DDReadBuffer( GLcontext *ctx, GLenum mode ) +static void mach64DDReadBuffer( struct gl_context *ctx, GLenum mode ) { /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */ } @@ -764,7 +764,7 @@ static void mach64DDReadBuffer( GLcontext *ctx, GLenum mode ) * State enable/disable */ -static void mach64DDEnable( GLcontext *ctx, GLenum cap, GLboolean state ) +static void mach64DDEnable( struct gl_context *ctx, GLenum cap, GLboolean state ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -867,7 +867,7 @@ static void mach64DDEnable( GLcontext *ctx, GLenum cap, GLboolean state ) * Render mode */ -static void mach64DDRenderMode( GLcontext *ctx, GLenum mode ) +static void mach64DDRenderMode( struct gl_context *ctx, GLenum mode ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); FALLBACK( mmesa, MACH64_FALLBACK_RENDER_MODE, (mode != GL_RENDER) ); @@ -971,7 +971,7 @@ static void mach64DDPrintState( const char *msg, GLuint flags ) } /* Update the hardware state */ -void mach64DDUpdateHWState( GLcontext *ctx ) +void mach64DDUpdateHWState( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); int new_state = mmesa->new_state; @@ -1018,7 +1018,7 @@ void mach64DDUpdateHWState( GLcontext *ctx ) } -static void mach64DDInvalidateState( GLcontext *ctx, GLuint new_state ) +static void mach64DDInvalidateState( struct gl_context *ctx, GLuint new_state ) { _swrast_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); @@ -1152,7 +1152,7 @@ void mach64DDInitState( mach64ContextPtr mmesa ) /* Initialize the driver's state functions. */ -void mach64DDInitStateFuncs( GLcontext *ctx ) +void mach64DDInitStateFuncs( struct gl_context *ctx ) { ctx->Driver.UpdateState = mach64DDInvalidateState; diff --git a/src/mesa/drivers/dri/mach64/mach64_state.h b/src/mesa/drivers/dri/mach64/mach64_state.h index 23081cb2fe..41c4d01d1d 100644 --- a/src/mesa/drivers/dri/mach64/mach64_state.h +++ b/src/mesa/drivers/dri/mach64/mach64_state.h @@ -34,13 +34,13 @@ #include "mach64_context.h" extern void mach64DDInitState( mach64ContextPtr mmesa ); -extern void mach64DDInitStateFuncs( GLcontext *ctx ); +extern void mach64DDInitStateFuncs( struct gl_context *ctx ); -extern void mach64SetCliprects( GLcontext *ctx, GLenum mode ); -extern void mach64CalcViewport( GLcontext *ctx ); +extern void mach64SetCliprects( struct gl_context *ctx, GLenum mode ); +extern void mach64CalcViewport( struct gl_context *ctx ); -extern void mach64DDUpdateState( GLcontext *ctx ); -extern void mach64DDUpdateHWState( GLcontext *ctx ); +extern void mach64DDUpdateState( struct gl_context *ctx ); +extern void mach64DDUpdateHWState( struct gl_context *ctx ); extern void mach64EmitHwStateLocked( mach64ContextPtr mmesa ); diff --git a/src/mesa/drivers/dri/mach64/mach64_tex.c b/src/mesa/drivers/dri/mach64/mach64_tex.c index 1bce967d58..68d273a3e7 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tex.c +++ b/src/mesa/drivers/dri/mach64/mach64_tex.c @@ -133,7 +133,7 @@ mach64AllocTexObj( struct gl_texture_object *texObj ) /* Called by the _mesa_store_teximage[123]d() functions. */ static gl_format -mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, +mach64ChooseTextureFormat( struct gl_context *ctx, GLint internalFormat, GLenum format, GLenum type ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -241,7 +241,7 @@ mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, } } -static void mach64TexImage1D( GLcontext *ctx, GLenum target, GLint level, +static void mach64TexImage1D( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -271,7 +271,7 @@ static void mach64TexImage1D( GLcontext *ctx, GLenum target, GLint level, mmesa->new_state |= MACH64_NEW_TEXTURE; } -static void mach64TexSubImage1D( GLcontext *ctx, +static void mach64TexSubImage1D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, @@ -304,7 +304,7 @@ static void mach64TexSubImage1D( GLcontext *ctx, mmesa->new_state |= MACH64_NEW_TEXTURE; } -static void mach64TexImage2D( GLcontext *ctx, GLenum target, GLint level, +static void mach64TexImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -334,7 +334,7 @@ static void mach64TexImage2D( GLcontext *ctx, GLenum target, GLint level, mmesa->new_state |= MACH64_NEW_TEXTURE; } -static void mach64TexSubImage2D( GLcontext *ctx, +static void mach64TexSubImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -371,7 +371,7 @@ static void mach64TexSubImage2D( GLcontext *ctx, * Device Driver API texture functions */ -static void mach64DDTexEnv( GLcontext *ctx, GLenum target, +static void mach64DDTexEnv( struct gl_context *ctx, GLenum target, GLenum pname, const GLfloat *param ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -425,7 +425,7 @@ static void mach64DDTexEnv( GLcontext *ctx, GLenum target, } } -static void mach64DDTexParameter( GLcontext *ctx, GLenum target, +static void mach64DDTexParameter( struct gl_context *ctx, GLenum target, struct gl_texture_object *tObj, GLenum pname, const GLfloat *params ) { @@ -489,7 +489,7 @@ static void mach64DDTexParameter( GLcontext *ctx, GLenum target, mmesa->new_state |= MACH64_NEW_TEXTURE; } -static void mach64DDBindTexture( GLcontext *ctx, GLenum target, +static void mach64DDBindTexture( struct gl_context *ctx, GLenum target, struct gl_texture_object *tObj ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -510,7 +510,7 @@ static void mach64DDBindTexture( GLcontext *ctx, GLenum target, mmesa->new_state |= MACH64_NEW_TEXTURE; } -static void mach64DDDeleteTexture( GLcontext *ctx, +static void mach64DDDeleteTexture( struct gl_context *ctx, struct gl_texture_object *tObj ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -537,7 +537,7 @@ static void mach64DDDeleteTexture( GLcontext *ctx, * texture object from the core mesa gl_texture_object. Not done at this time. */ static struct gl_texture_object * -mach64NewTextureObject( GLcontext *ctx, GLuint name, GLenum target ) +mach64NewTextureObject( struct gl_context *ctx, GLuint name, GLenum target ) { struct gl_texture_object *obj; obj = _mesa_new_texture_object(ctx, name, target); @@ -559,7 +559,5 @@ void mach64InitTextureFuncs( struct dd_function_table *functions ) functions->DeleteTexture = mach64DDDeleteTexture; functions->IsTextureResident = driIsTextureResident; - functions->UpdateTexturePalette = NULL; - driInitTextureFormats(); } diff --git a/src/mesa/drivers/dri/mach64/mach64_tex.h b/src/mesa/drivers/dri/mach64/mach64_tex.h index 8e0b23ed15..0369982853 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tex.h +++ b/src/mesa/drivers/dri/mach64/mach64_tex.h @@ -32,7 +32,7 @@ #ifndef __MACH64_TEX_H__ #define __MACH64_TEX_H__ -extern void mach64UpdateTextureState( GLcontext *ctx ); +extern void mach64UpdateTextureState( struct gl_context *ctx ); extern void mach64UploadTexImages( mach64ContextPtr mach64ctx, mach64TexObjPtr t ); diff --git a/src/mesa/drivers/dri/mach64/mach64_texstate.c b/src/mesa/drivers/dri/mach64/mach64_texstate.c index adf774ec19..70365c8461 100644 --- a/src/mesa/drivers/dri/mach64/mach64_texstate.c +++ b/src/mesa/drivers/dri/mach64/mach64_texstate.c @@ -108,7 +108,7 @@ static void mach64SetTexImages( mach64ContextPtr mmesa, t->maxLog2 = baseImage->MaxLog2; } -static void mach64UpdateTextureEnv( GLcontext *ctx, int unit ) +static void mach64UpdateTextureEnv( struct gl_context *ctx, int unit ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); GLint source = mmesa->tmu_source[unit]; @@ -284,7 +284,7 @@ static void mach64UpdateTextureEnv( GLcontext *ctx, int unit ) } -static void mach64UpdateTextureUnit( GLcontext *ctx, int unit ) +static void mach64UpdateTextureUnit( struct gl_context *ctx, int unit ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); int source = mmesa->tmu_source[unit]; @@ -427,7 +427,7 @@ static void mach64UpdateTextureUnit( GLcontext *ctx, int unit ) /* Update the hardware texture state */ -void mach64UpdateTextureState( GLcontext *ctx ) +void mach64UpdateTextureState( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/mach64/mach64_tris.c b/src/mesa/drivers/dri/mach64/mach64_tris.c index a81d21afff..024ee2f435 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tris.c +++ b/src/mesa/drivers/dri/mach64/mach64_tris.c @@ -59,8 +59,8 @@ static const GLuint hw_prim[GL_POLYGON+1] = { MACH64_PRIM_POLYGON, }; -static void mach64RasterPrimitive( GLcontext *ctx, GLuint hwprim ); -static void mach64RenderPrimitive( GLcontext *ctx, GLenum prim ); +static void mach64RasterPrimitive( struct gl_context *ctx, GLuint hwprim ); +static void mach64RenderPrimitive( struct gl_context *ctx, GLenum prim ); /* FIXME: Remove this when native template is finished. */ @@ -120,7 +120,7 @@ static INLINE void mach64_draw_quad( mach64ContextPtr mmesa, mach64VertexPtr v3 ) { #if MACH64_NATIVE_VTXFMT - GLcontext *ctx = mmesa->glCtx; + struct gl_context *ctx = mmesa->glCtx; const GLuint vertsize = mmesa->vertex_size; GLint a; GLfloat ooa; @@ -425,7 +425,7 @@ static INLINE void mach64_draw_triangle( mach64ContextPtr mmesa, mach64VertexPtr v2 ) { #if MACH64_NATIVE_VTXFMT - GLcontext *ctx = mmesa->glCtx; + struct gl_context *ctx = mmesa->glCtx; GLuint vertsize = mmesa->vertex_size; GLint a; GLfloat ooa; @@ -671,7 +671,7 @@ static INLINE void mach64_draw_line( mach64ContextPtr mmesa, mach64VertexPtr v1 ) { #if MACH64_NATIVE_VTXFMT - GLcontext *ctx = mmesa->glCtx; + struct gl_context *ctx = mmesa->glCtx; const GLuint vertsize = mmesa->vertex_size; /* 2 fractional bits for hardware: */ const int width = (int) (2.0 * CLAMP(mmesa->glCtx->Line.Width, @@ -959,7 +959,7 @@ static INLINE void mach64_draw_point( mach64ContextPtr mmesa, mach64VertexPtr v0 ) { #if MACH64_NATIVE_VTXFMT - GLcontext *ctx = mmesa->glCtx; + struct gl_context *ctx = mmesa->glCtx; const GLuint vertsize = mmesa->vertex_size; /* 2 fractional bits for hardware: */ GLint sz = (GLint) (2.0 * CLAMP(mmesa->glCtx->Point.Size, @@ -1473,7 +1473,7 @@ mach64_fallback_tri( mach64ContextPtr mmesa, mach64Vertex *v1, mach64Vertex *v2 ) { - GLcontext *ctx = mmesa->glCtx; + struct gl_context *ctx = mmesa->glCtx; SWvertex v[3]; mach64_translate_vertex( ctx, v0, &v[0] ); mach64_translate_vertex( ctx, v1, &v[1] ); @@ -1487,7 +1487,7 @@ mach64_fallback_line( mach64ContextPtr mmesa, mach64Vertex *v0, mach64Vertex *v1 ) { - GLcontext *ctx = mmesa->glCtx; + struct gl_context *ctx = mmesa->glCtx; SWvertex v[2]; mach64_translate_vertex( ctx, v0, &v[0] ); mach64_translate_vertex( ctx, v1, &v[1] ); @@ -1499,7 +1499,7 @@ static void mach64_fallback_point( mach64ContextPtr mmesa, mach64Vertex *v0 ) { - GLcontext *ctx = mmesa->glCtx; + struct gl_context *ctx = mmesa->glCtx; SWvertex v[1]; mach64_translate_vertex( ctx, v0, &v[0] ); _swrast_Point( ctx, &v[0] ); @@ -1549,7 +1549,7 @@ mach64_fallback_point( mach64ContextPtr mmesa, /* Render clipped primitives */ /**********************************************************************/ -static void mach64RenderClippedPoly( GLcontext *ctx, const GLuint *elts, +static void mach64RenderClippedPoly( struct gl_context *ctx, const GLuint *elts, GLuint n ) { mach64ContextPtr mmesa = MACH64_CONTEXT( ctx ); @@ -1573,14 +1573,14 @@ static void mach64RenderClippedPoly( GLcontext *ctx, const GLuint *elts, } -static void mach64RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) +static void mach64RenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->Driver.Render.Line( ctx, ii, jj ); } #if MACH64_NATIVE_VTXFMT -static void mach64FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, +static void mach64FastRenderClippedPoly( struct gl_context *ctx, const GLuint *elts, GLuint n ) { mach64ContextPtr mmesa = MACH64_CONTEXT( ctx ); @@ -1675,7 +1675,7 @@ static void mach64FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, assert( vb == vbchk ); } #else -static void mach64FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, +static void mach64FastRenderClippedPoly( struct gl_context *ctx, const GLuint *elts, GLuint n ) { mach64ContextPtr mmesa = MACH64_CONTEXT( ctx ); @@ -1715,7 +1715,7 @@ static void mach64FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, #define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED) -static void mach64ChooseRenderState(GLcontext *ctx) +static void mach64ChooseRenderState(struct gl_context *ctx) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); GLuint flags = ctx->_TriangleCaps; @@ -1769,7 +1769,7 @@ static void mach64ChooseRenderState(GLcontext *ctx) /* Validate state at pipeline start */ /**********************************************************************/ -static void mach64RunPipeline( GLcontext *ctx ) +static void mach64RunPipeline( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -1798,7 +1798,7 @@ static void mach64RunPipeline( GLcontext *ctx ) * and lines, points and bitmaps. */ -static void mach64RasterPrimitive( GLcontext *ctx, GLuint hwprim ) +static void mach64RasterPrimitive( struct gl_context *ctx, GLuint hwprim ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -1811,7 +1811,7 @@ static void mach64RasterPrimitive( GLcontext *ctx, GLuint hwprim ) } } -static void mach64RenderPrimitive( GLcontext *ctx, GLenum prim ) +static void mach64RenderPrimitive( struct gl_context *ctx, GLenum prim ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); GLuint hw = hw_prim[prim]; @@ -1825,7 +1825,7 @@ static void mach64RenderPrimitive( GLcontext *ctx, GLenum prim ) } -static void mach64RenderStart( GLcontext *ctx ) +static void mach64RenderStart( struct gl_context *ctx ) { /* Check for projective texturing. Make sure all texcoord * pointers point to something. (fix in mesa?) @@ -1833,7 +1833,7 @@ static void mach64RenderStart( GLcontext *ctx ) mach64CheckTexSizes( ctx ); } -static void mach64RenderFinish( GLcontext *ctx ) +static void mach64RenderFinish( struct gl_context *ctx ) { if (MACH64_CONTEXT(ctx)->RenderIndex & MACH64_FALLBACK_BIT) _swrast_flush( ctx ); @@ -1868,7 +1868,7 @@ static const char *getFallbackString(GLuint bit) return fallbackStrings[i]; } -void mach64Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ) +void mach64Fallback( struct gl_context *ctx, GLuint bit, GLboolean mode ) { TNLcontext *tnl = TNL_CONTEXT(ctx); mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); @@ -1908,7 +1908,7 @@ void mach64Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ) /* Initialization. */ /**********************************************************************/ -void mach64InitTriFuncs( GLcontext *ctx ) +void mach64InitTriFuncs( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); static int firsttime = 1; diff --git a/src/mesa/drivers/dri/mach64/mach64_tris.h b/src/mesa/drivers/dri/mach64/mach64_tris.h index 042df42f5b..84f613c4ab 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tris.h +++ b/src/mesa/drivers/dri/mach64/mach64_tris.h @@ -33,10 +33,10 @@ #include "main/mtypes.h" -extern void mach64InitTriFuncs( GLcontext *ctx ); +extern void mach64InitTriFuncs( struct gl_context *ctx ); -extern void mach64Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ); +extern void mach64Fallback( struct gl_context *ctx, GLuint bit, GLboolean mode ); #define FALLBACK( mmesa, bit, mode ) mach64Fallback( mmesa->glCtx, bit, mode ) diff --git a/src/mesa/drivers/dri/mach64/mach64_vb.c b/src/mesa/drivers/dri/mach64/mach64_vb.c index 046aff28a8..d0c04d3d03 100644 --- a/src/mesa/drivers/dri/mach64/mach64_vb.c +++ b/src/mesa/drivers/dri/mach64/mach64_vb.c @@ -54,10 +54,10 @@ #define MACH64_MAX_SETUP 0x80 static struct { - void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint ); + void (*emit)( struct gl_context *, GLuint, GLuint, void *, GLuint ); tnl_interp_func interp; tnl_copy_pv_func copy_pv; - GLboolean (*check_tex_sizes)( GLcontext *ctx ); + GLboolean (*check_tex_sizes)( struct gl_context *ctx ); GLuint vertex_size; GLuint vertex_format; } setup_tab[MACH64_MAX_SETUP]; @@ -491,7 +491,7 @@ void mach64PrintSetupFlags( char *msg, GLuint flags ) -void mach64CheckTexSizes( GLcontext *ctx ) +void mach64CheckTexSizes( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT( ctx ); @@ -511,7 +511,7 @@ void mach64CheckTexSizes( GLcontext *ctx ) } } -void mach64BuildVertices( GLcontext *ctx, +void mach64BuildVertices( struct gl_context *ctx, GLuint start, GLuint count, GLuint newinputs ) @@ -557,7 +557,7 @@ void mach64BuildVertices( GLcontext *ctx, } } -void mach64ChooseVertexState( GLcontext *ctx ) +void mach64ChooseVertexState( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); mach64ContextPtr mmesa = MACH64_CONTEXT( ctx ); @@ -602,7 +602,7 @@ void mach64ChooseVertexState( GLcontext *ctx ) #if 0 -void mach64_emit_contiguous_verts( GLcontext *ctx, +void mach64_emit_contiguous_verts( struct gl_context *ctx, GLuint start, GLuint count ) { @@ -614,7 +614,7 @@ void mach64_emit_contiguous_verts( GLcontext *ctx, #endif -void mach64InitVB( GLcontext *ctx ) +void mach64InitVB( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); GLuint size = TNL_CONTEXT(ctx)->vb.Size; @@ -631,7 +631,7 @@ void mach64InitVB( GLcontext *ctx ) } -void mach64FreeVB( GLcontext *ctx ) +void mach64FreeVB( struct gl_context *ctx ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); if (mmesa->verts) { diff --git a/src/mesa/drivers/dri/mach64/mach64_vb.h b/src/mesa/drivers/dri/mach64/mach64_vb.h index e0b366916b..8d9cd5b492 100644 --- a/src/mesa/drivers/dri/mach64/mach64_vb.h +++ b/src/mesa/drivers/dri/mach64/mach64_vb.h @@ -46,32 +46,32 @@ _NEW_FOG) -extern void mach64CheckTexSizes( GLcontext *ctx ); -extern void mach64ChooseVertexState( GLcontext *ctx ); +extern void mach64CheckTexSizes( struct gl_context *ctx ); +extern void mach64ChooseVertexState( struct gl_context *ctx ); -extern void mach64BuildVertices( GLcontext *ctx, GLuint start, GLuint count, +extern void mach64BuildVertices( struct gl_context *ctx, GLuint start, GLuint count, GLuint newinputs ); extern void mach64PrintSetupFlags(char *msg, GLuint flags ); -extern void mach64InitVB( GLcontext *ctx ); -extern void mach64FreeVB( GLcontext *ctx ); +extern void mach64InitVB( struct gl_context *ctx ); +extern void mach64FreeVB( struct gl_context *ctx ); #if 0 -extern void mach64_emit_contiguous_verts( GLcontext *ctx, +extern void mach64_emit_contiguous_verts( struct gl_context *ctx, GLuint start, GLuint count ); -extern void mach64_emit_indexed_verts( GLcontext *ctx, +extern void mach64_emit_indexed_verts( struct gl_context *ctx, GLuint start, GLuint count ); #endif -extern void mach64_translate_vertex( GLcontext *ctx, +extern void mach64_translate_vertex( struct gl_context *ctx, const mach64Vertex *src, SWvertex *dst ); -extern void mach64_print_vertex( GLcontext *ctx, const mach64Vertex *v ); +extern void mach64_print_vertex( struct gl_context *ctx, const mach64Vertex *v ); #endif /* __MACH64_VB_H__ */ diff --git a/src/mesa/drivers/dri/mach64/mach64_vbtmp.h b/src/mesa/drivers/dri/mach64/mach64_vbtmp.h index 60bfab8f6d..a126dcae40 100644 --- a/src/mesa/drivers/dri/mach64/mach64_vbtmp.h +++ b/src/mesa/drivers/dri/mach64/mach64_vbtmp.h @@ -118,7 +118,7 @@ #if (HAVE_HW_DIVIDE || DO_SPEC || DO_TEX0 || DO_FOG || !HAVE_TINY_VERTICES) -static void TAG(emit)( GLcontext *ctx, +static void TAG(emit)( struct gl_context *ctx, GLuint start, GLuint end, void *dest, GLuint stride ) @@ -366,7 +366,7 @@ static void TAG(emit)( GLcontext *ctx, #error "cannot use tiny vertices with hw perspective divide" #endif -static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end, +static void TAG(emit)( struct gl_context *ctx, GLuint start, GLuint end, void *dest, GLuint stride ) { LOCALVARS @@ -422,7 +422,7 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end, } } #else -static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end, +static void TAG(emit)( struct gl_context *ctx, GLuint start, GLuint end, void *dest, GLuint stride ) { LOCALVARS @@ -466,7 +466,7 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end, #if (HAVE_PTEX_VERTICES) -static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) +static GLboolean TAG(check_tex_sizes)( struct gl_context *ctx ) { LOCALVARS struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; @@ -494,7 +494,7 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) return GL_TRUE; } #else -static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) +static GLboolean TAG(check_tex_sizes)( struct gl_context *ctx ) { LOCALVARS struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; @@ -535,7 +535,7 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) #endif /* ptex */ -static void TAG(interp)( GLcontext *ctx, +static void TAG(interp)( struct gl_context *ctx, GLfloat t, GLuint edst, GLuint eout, GLuint ein, GLboolean force_boundary ) diff --git a/src/mesa/drivers/dri/mga/mga_texcombine.c b/src/mesa/drivers/dri/mga/mga_texcombine.c index 24083d9651..1488a89bb6 100644 --- a/src/mesa/drivers/dri/mga/mga_texcombine.c +++ b/src/mesa/drivers/dri/mga/mga_texcombine.c @@ -41,7 +41,7 @@ #define MGA_ARG2 1 #define MGA_ALPHA 2 -GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit ) +GLboolean mgaUpdateTextureEnvCombine( struct gl_context *ctx, int unit ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); const int source = mmesa->tmu_source[unit]; diff --git a/src/mesa/drivers/dri/mga/mga_texstate.c b/src/mesa/drivers/dri/mga/mga_texstate.c index 54eda62a96..33ad8b4256 100644 --- a/src/mesa/drivers/dri/mga/mga_texstate.c +++ b/src/mesa/drivers/dri/mga/mga_texstate.c @@ -196,7 +196,7 @@ mgaSetTexImages( mgaContextPtr mmesa, * Texture unit state management */ -static void mgaUpdateTextureEnvG200( GLcontext *ctx, GLuint unit ) +static void mgaUpdateTextureEnvG200( struct gl_context *ctx, GLuint unit ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); struct gl_texture_object *tObj = ctx->Texture.Unit[0]._Current; @@ -526,7 +526,7 @@ static const GLuint g400_alpha_combine[][MGA_MAX_COMBFUNC] = }, }; -static GLboolean mgaUpdateTextureEnvBlend( GLcontext *ctx, int unit ) +static GLboolean mgaUpdateTextureEnvBlend( struct gl_context *ctx, int unit ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); const int source = mmesa->tmu_source[unit]; @@ -622,7 +622,7 @@ static GLboolean mgaUpdateTextureEnvBlend( GLcontext *ctx, int unit ) return GL_TRUE; } -static void mgaUpdateTextureEnvG400( GLcontext *ctx, GLuint unit ) +static void mgaUpdateTextureEnvG400( struct gl_context *ctx, GLuint unit ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); const int source = mmesa->tmu_source[unit]; @@ -719,7 +719,7 @@ static void mgaUpdateTextureEnvG400( GLcontext *ctx, GLuint unit ) } } -static void disable_tex( GLcontext *ctx, int unit ) +static void disable_tex( struct gl_context *ctx, int unit ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); @@ -747,7 +747,7 @@ static void disable_tex( GLcontext *ctx, int unit ) mmesa->dirty |= MGA_UPLOAD_CONTEXT | (MGA_UPLOAD_TEX0 << unit); } -static GLboolean enable_tex( GLcontext *ctx, int unit ) +static GLboolean enable_tex( struct gl_context *ctx, int unit ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); const int source = mmesa->tmu_source[unit]; @@ -768,7 +768,7 @@ static GLboolean enable_tex( GLcontext *ctx, int unit ) return GL_TRUE; } -static GLboolean update_tex_common( GLcontext *ctx, int unit ) +static GLboolean update_tex_common( struct gl_context *ctx, int unit ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); const int source = mmesa->tmu_source[unit]; @@ -842,7 +842,7 @@ static GLboolean update_tex_common( GLcontext *ctx, int unit ) } -static GLboolean updateTextureUnit( GLcontext *ctx, int unit ) +static GLboolean updateTextureUnit( struct gl_context *ctx, int unit ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); const int source = mmesa->tmu_source[unit]; @@ -865,7 +865,7 @@ static GLboolean updateTextureUnit( GLcontext *ctx, int unit ) /* The G400 is now programmed quite differently wrt texture environment. */ -void mgaUpdateTextureState( GLcontext *ctx ) +void mgaUpdateTextureState( struct gl_context *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); GLboolean ok; diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 3a31dfb44a..d1b281a2c0 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -57,7 +57,6 @@ #include "mgatris.h" #include "mgavb.h" #include "mgapixel.h" -#include "mga_xmesa.h" #include "mga_dri.h" #include "utils.h" @@ -111,7 +110,7 @@ mgaFillInModes( __DRIscreen *psp, unsigned stencil_bits, GLboolean have_back_buffer ) { __DRIconfig **configs; - __GLcontextModes * m; + struct gl_config * m; unsigned depth_buffer_factor; unsigned back_buffer_factor; GLenum fb_format; @@ -394,7 +393,6 @@ static const struct dri_extension card_extensions[] = { "GL_EXT_stencil_wrap", NULL }, { "GL_APPLE_vertex_array_object", GL_APPLE_vertex_array_object_functions }, { "GL_MESA_ycbcr_texture", NULL }, - { "GL_SGIS_generate_mipmap", NULL }, { NULL, NULL } }; @@ -423,13 +421,13 @@ static const struct dri_debug_control debug_control[] = static GLboolean mgaCreateContext( gl_api api, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, __DRIcontext *driContextPriv, void *sharedContextPrivate ) { int i; unsigned maxlevels; - GLcontext *ctx, *shareCtx; + struct gl_context *ctx, *shareCtx; mgaContextPtr mmesa; __DRIscreen *sPriv = driContextPriv->driScreenPriv; mgaScreenPrivate *mgaScreen = (mgaScreenPrivate *)sPriv->private; @@ -697,7 +695,7 @@ mgaDestroyContext(__DRIcontext *driContextPriv) static GLboolean mgaCreateBuffer( __DRIscreen *driScrnPriv, __DRIdrawable *driDrawPriv, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, GLboolean isPixmap ) { mgaScreenPrivate *screen = (mgaScreenPrivate *) driScrnPriv->private; @@ -814,7 +812,7 @@ mgaCreateBuffer( __DRIscreen *driScrnPriv, static void mgaDestroyBuffer(__DRIdrawable *driDrawPriv) { - _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL); + _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL); } static void @@ -822,7 +820,7 @@ mgaSwapBuffers(__DRIdrawable *dPriv) { if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) { mgaContextPtr mmesa; - GLcontext *ctx; + struct gl_context *ctx; mmesa = (mgaContextPtr) dPriv->driContextPriv->driverPrivate; ctx = mmesa->glCtx; @@ -877,8 +875,8 @@ mgaMakeCurrent(__DRIcontext *driContextPriv, mmesa->driReadable = driReadPriv; _mesa_make_current(mmesa->glCtx, - (GLframebuffer *) driDrawPriv->driverPrivate, - (GLframebuffer *) driReadPriv->driverPrivate); + (struct gl_framebuffer *) driDrawPriv->driverPrivate, + (struct gl_framebuffer *) driReadPriv->driverPrivate); } else { _mesa_make_current(NULL, NULL, NULL); @@ -927,7 +925,7 @@ void mgaGetLock( mgaContextPtr mmesa, GLuint flags ) * * \todo maybe fold this into intelInitDriver * - * \return the __GLcontextModes supported by this driver + * \return the struct gl_config supported by this driver */ static const __DRIconfig **mgaInitScreen(__DRIscreen *psp) { diff --git a/src/mesa/drivers/dri/mga/mgacontext.h b/src/mesa/drivers/dri/mga/mgacontext.h index 4141565931..b1fbb3c45d 100644 --- a/src/mesa/drivers/dri/mga/mgacontext.h +++ b/src/mesa/drivers/dri/mga/mgacontext.h @@ -179,7 +179,7 @@ struct mga_hw_state { struct mga_context_t { - GLcontext *glCtx; + struct gl_context *glCtx; unsigned int lastStamp; /* fullscreen breaks dpriv->laststamp, * need to shadow it here. */ diff --git a/src/mesa/drivers/dri/mga/mgadd.c b/src/mesa/drivers/dri/mga/mgadd.c index 2f23c0e514..1b39813e37 100644 --- a/src/mesa/drivers/dri/mga/mgadd.c +++ b/src/mesa/drivers/dri/mga/mgadd.c @@ -43,7 +43,7 @@ ***************************************/ -static const GLubyte *mgaGetString( GLcontext *ctx, GLenum name ) +static const GLubyte *mgaGetString( struct gl_context *ctx, GLenum name ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); static char buffer[128]; diff --git a/src/mesa/drivers/dri/mga/mgaioctl.c b/src/mesa/drivers/dri/mga/mgaioctl.c index 259358eaa3..a54d86a178 100644 --- a/src/mesa/drivers/dri/mga/mgaioctl.c +++ b/src/mesa/drivers/dri/mga/mgaioctl.c @@ -201,7 +201,7 @@ drmBufPtr mga_get_buffer_ioctl( mgaContextPtr mmesa ) static void -mgaClear( GLcontext *ctx, GLbitfield mask ) +mgaClear( struct gl_context *ctx, GLbitfield mask ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); __DRIdrawable *dPriv = mmesa->driDrawable; @@ -479,7 +479,7 @@ void mgaCopyBuffer( __DRIdrawable *dPriv ) * * \sa glFinish, mgaFlush, mgaFlushDMA */ -static void mgaFinish( GLcontext *ctx ) +static void mgaFinish( struct gl_context *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); uint32_t fence; @@ -688,7 +688,7 @@ void mgaGetILoadBufferLocked( mgaContextPtr mmesa ) * * \sa glFlush, mgaFinish, mgaFlushDMA */ -static void mgaFlush( GLcontext *ctx ) +static void mgaFlush( struct gl_context *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); diff --git a/src/mesa/drivers/dri/mga/mgapixel.c b/src/mesa/drivers/dri/mga/mgapixel.c index 664f7c77c2..b8e365c714 100644 --- a/src/mesa/drivers/dri/mga/mgapixel.c +++ b/src/mesa/drivers/dri/mga/mgapixel.c @@ -55,16 +55,15 @@ (((unsigned long)p) - (unsigned long)mmesa->mgaScreen->buffers.map) -#if defined(MESA_packed_depth_stencil) static GLboolean -check_depth_stencil_24_8( const GLcontext *ctx, GLenum type, +check_depth_stencil_24_8( const struct gl_context *ctx, GLenum type, const struct gl_pixelstore_attrib *packing, const void *pixels, GLint sz, GLint pitch ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); - return ( type == GL_UNSIGNED_INT_24_8_MESA && + return ( type == GL_UNSIGNED_INT_24_8 && ctx->Visual->DepthBits == 24 && ctx->Visual->StencilBits == 8 && mmesa->mgaScreen->cpp == 4 && @@ -78,11 +77,10 @@ check_depth_stencil_24_8( const GLcontext *ctx, GLenum type, pitch % 32 == 0 && pitch < 4096 ); } -#endif static GLboolean -check_depth( const GLcontext *ctx, GLenum type, +check_depth( const struct gl_context *ctx, GLenum type, const struct gl_pixelstore_attrib *packing, const void *pixels, GLint sz, GLint pitch ) { @@ -102,7 +100,7 @@ check_depth( const GLcontext *ctx, GLenum type, static GLboolean -check_color( const GLcontext *ctx, GLenum type, GLenum format, +check_color( const struct gl_context *ctx, GLenum type, GLenum format, const struct gl_pixelstore_attrib *packing, const void *pixels, GLint sz, GLint pitch ) { @@ -127,7 +125,7 @@ check_color( const GLcontext *ctx, GLenum type, GLenum format, } static GLboolean -check_color_per_fragment_ops( const GLcontext *ctx ) +check_color_per_fragment_ops( const struct gl_context *ctx ) { return (!( ctx->Color.AlphaEnabled || ctx->Depth.Test || @@ -147,7 +145,7 @@ check_color_per_fragment_ops( const GLcontext *ctx ) } static GLboolean -check_depth_per_fragment_ops( const GLcontext *ctx ) +check_depth_per_fragment_ops( const struct gl_context *ctx ) { return ( ctx->Current.RasterPosValid && ctx->Color.ColorMask[0][RCOMP] == 0 && @@ -162,7 +160,7 @@ check_depth_per_fragment_ops( const GLcontext *ctx ) */ #if defined(MESA_packed_depth_stencil) static GLboolean -check_stencil_per_fragment_ops( const GLcontext *ctx ) +check_stencil_per_fragment_ops( const struct gl_context *ctx ) { return ( !ctx->Pixel.IndexShift && !ctx->Pixel.IndexOffset ); @@ -171,8 +169,8 @@ check_stencil_per_fragment_ops( const GLcontext *ctx ) static GLboolean -clip_pixelrect( const GLcontext *ctx, - const GLframebuffer *buffer, +clip_pixelrect( const struct gl_context *ctx, + const struct gl_framebuffer *buffer, GLint *x, GLint *y, GLsizei *width, GLsizei *height, GLint *skipPixels, GLint *skipRows, @@ -217,7 +215,7 @@ clip_pixelrect( const GLcontext *ctx, } static GLboolean -mgaTryReadPixels( GLcontext *ctx, +mgaTryReadPixels( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *pack, @@ -252,13 +250,11 @@ mgaTryReadPixels( GLcontext *ctx, return GL_FALSE; switch (format) { -#if defined(MESA_packed_depth_stencil) - case GL_DEPTH_STENCIL_MESA: + case GL_DEPTH_STENCIL: ok = check_depth_stencil_24_8(ctx, type, pack, pixels, size, pitch); planemask = ~0; source = mmesa->mgaScreen->depthOffset; break; -#endif case GL_DEPTH_COMPONENT: ok = check_depth(ctx, type, pack, pixels, size, pitch); @@ -377,7 +373,7 @@ mgaTryReadPixels( GLcontext *ctx, } static void -mgaDDReadPixels( GLcontext *ctx, +mgaDDReadPixels( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *pack, @@ -390,7 +386,7 @@ mgaDDReadPixels( GLcontext *ctx, -static void do_draw_pix( GLcontext *ctx, +static void do_draw_pix( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLint pitch, const void *pixels, @@ -474,7 +470,7 @@ static void do_draw_pix( GLcontext *ctx, static GLboolean -mgaTryDrawPixels( GLcontext *ctx, +mgaTryDrawPixels( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, @@ -494,8 +490,7 @@ mgaTryDrawPixels( GLcontext *ctx, switch (format) { -#if defined(MESA_packed_depth_stencil) - case GL_DEPTH_STENCIL_MESA: + case GL_DEPTH_STENCIL: dest = mmesa->mgaScreen->depthOffset; planemask = ~0; if (!check_depth_stencil_24_8(ctx, type, unpack, pixels, size, pitch) || @@ -503,7 +498,6 @@ mgaTryDrawPixels( GLcontext *ctx, !check_stencil_per_fragment_ops(ctx)) return GL_FALSE; break; -#endif case GL_DEPTH_COMPONENT: dest = mmesa->mgaScreen->depthOffset; @@ -625,7 +619,7 @@ mgaTryDrawPixels( GLcontext *ctx, } static void -mgaDDDrawPixels( GLcontext *ctx, +mgaDDDrawPixels( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, @@ -643,7 +637,7 @@ mgaDDDrawPixels( GLcontext *ctx, * the same block of agp space which isn't used for anything else at * present. */ -void mgaDDInitPixelFuncs( GLcontext *ctx ) +void mgaDDInitPixelFuncs( struct gl_context *ctx ) { #if 0 /* evidently, these functions don't always work */ diff --git a/src/mesa/drivers/dri/mga/mgapixel.h b/src/mesa/drivers/dri/mga/mgapixel.h index f5f300db56..6241b4b5ef 100644 --- a/src/mesa/drivers/dri/mga/mgapixel.h +++ b/src/mesa/drivers/dri/mga/mgapixel.h @@ -30,6 +30,6 @@ #include "main/mtypes.h" -extern void mgaDDInitPixelFuncs( GLcontext *ctx ); +extern void mgaDDInitPixelFuncs( struct gl_context *ctx ); #endif diff --git a/src/mesa/drivers/dri/mga/mgarender.c b/src/mesa/drivers/dri/mga/mgarender.c index cc0cea618d..f10a91adce 100644 --- a/src/mesa/drivers/dri/mga/mgarender.c +++ b/src/mesa/drivers/dri/mga/mgarender.c @@ -66,7 +66,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define HAVE_ELTS 0 /* for now */ -static void mgaDmaPrimitive( GLcontext *ctx, GLenum prim ) +static void mgaDmaPrimitive( struct gl_context *ctx, GLenum prim ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); GLuint hwprim; @@ -124,7 +124,7 @@ static void mgaDmaPrimitive( GLcontext *ctx, GLenum prim ) /**********************************************************************/ -static GLboolean mga_run_render( GLcontext *ctx, +static GLboolean mga_run_render( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/mga/mgaspan.c b/src/mesa/drivers/dri/mga/mgaspan.c index 10606c152c..dd9a8d74ed 100644 --- a/src/mesa/drivers/dri/mga/mgaspan.c +++ b/src/mesa/drivers/dri/mga/mgaspan.c @@ -169,7 +169,7 @@ static void -mgaSpanRenderStart( GLcontext *ctx ) +mgaSpanRenderStart( struct gl_context *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); FLUSH_BATCH( mmesa ); @@ -177,7 +177,7 @@ mgaSpanRenderStart( GLcontext *ctx ) } static void -mgaSpanRenderFinish( GLcontext *ctx ) +mgaSpanRenderFinish( struct gl_context *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); _swrast_flush( ctx ); @@ -192,7 +192,7 @@ mgaSpanRenderFinish( GLcontext *ctx ) * write routines for 888 and 8888. We also need to determine whether or not * the visual has destination alpha. */ -void mgaDDInitSpanFuncs( GLcontext *ctx ) +void mgaDDInitSpanFuncs( struct gl_context *ctx ) { struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx); swdd->SpanRenderStart = mgaSpanRenderStart; @@ -204,7 +204,7 @@ void mgaDDInitSpanFuncs( GLcontext *ctx ) * Plug in the Get/Put routines for the given driRenderbuffer. */ void -mgaSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis) +mgaSetSpanFunctions(driRenderbuffer *drb, const struct gl_config *vis) { if (drb->Base.Format == MESA_FORMAT_RGB565) { mgaInitPointers_565(&drb->Base); diff --git a/src/mesa/drivers/dri/mga/mgaspan.h b/src/mesa/drivers/dri/mga/mgaspan.h index f5e2e49b8a..48186b46e9 100644 --- a/src/mesa/drivers/dri/mga/mgaspan.h +++ b/src/mesa/drivers/dri/mga/mgaspan.h @@ -30,10 +30,10 @@ #include "drirenderbuffer.h" -extern void mgaDDInitSpanFuncs( GLcontext *ctx ); +extern void mgaDDInitSpanFuncs( struct gl_context *ctx ); extern void -mgaSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis); +mgaSetSpanFunctions(driRenderbuffer *rb, const struct gl_config *vis); #endif diff --git a/src/mesa/drivers/dri/mga/mgastate.c b/src/mesa/drivers/dri/mga/mgastate.c index 745d5e9852..25d7de28fe 100644 --- a/src/mesa/drivers/dri/mga/mgastate.c +++ b/src/mesa/drivers/dri/mga/mgastate.c @@ -51,7 +51,7 @@ #include "drirenderbuffer.h" -static void updateSpecularLighting( GLcontext *ctx ); +static void updateSpecularLighting( struct gl_context *ctx ); static const GLuint mgarop_NoBLK[16] = { DC_atype_rpl | 0x00000000, DC_atype_rstr | 0x00080000, @@ -68,7 +68,7 @@ static const GLuint mgarop_NoBLK[16] = { * Alpha blending */ -static void mgaDDAlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref) +static void mgaDDAlphaFunc(struct gl_context *ctx, GLenum func, GLfloat ref) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); GLubyte refByte; @@ -111,7 +111,7 @@ static void mgaDDAlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref) mmesa->hw.alpha_func = a | MGA_FIELD( AC_atref, refByte ); } -static void updateBlendLogicOp(GLcontext *ctx) +static void updateBlendLogicOp(struct gl_context *ctx) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); GLboolean logicOp = RGBA_LOGICOP_ENABLED(ctx); @@ -126,14 +126,14 @@ static void updateBlendLogicOp(GLcontext *ctx) mmesa->hw.blend_func == (AC_src_src_alpha_sat | AC_dst_zero) ); } -static void mgaDDBlendEquationSeparate(GLcontext *ctx, +static void mgaDDBlendEquationSeparate(struct gl_context *ctx, GLenum modeRGB, GLenum modeA) { assert( modeRGB == modeA ); updateBlendLogicOp( ctx ); } -static void mgaDDBlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB, +static void mgaDDBlendFuncSeparate( struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) { @@ -205,7 +205,7 @@ static void mgaDDBlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB, * Depth testing */ -static void mgaDDDepthFunc(GLcontext *ctx, GLenum func) +static void mgaDDDepthFunc(struct gl_context *ctx, GLenum func) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); int zmode; @@ -239,7 +239,7 @@ static void mgaDDDepthFunc(GLcontext *ctx, GLenum func) mmesa->hw.zmode |= zmode; } -static void mgaDDDepthMask(GLcontext *ctx, GLboolean flag) +static void mgaDDDepthMask(struct gl_context *ctx, GLboolean flag) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); @@ -250,7 +250,7 @@ static void mgaDDDepthMask(GLcontext *ctx, GLboolean flag) } -static void mgaDDClearDepth(GLcontext *ctx, GLclampd d) +static void mgaDDClearDepth(struct gl_context *ctx, GLclampd d) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -272,7 +272,7 @@ static void mgaDDClearDepth(GLcontext *ctx, GLclampd d) */ -static void mgaDDFogfv(GLcontext *ctx, GLenum pname, const GLfloat *param) +static void mgaDDFogfv(struct gl_context *ctx, GLenum pname, const GLfloat *param) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -292,7 +292,7 @@ static void mgaDDFogfv(GLcontext *ctx, GLenum pname, const GLfloat *param) */ -void mgaUpdateClipping(const GLcontext *ctx) +void mgaUpdateClipping(const struct gl_context *ctx) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -319,7 +319,7 @@ void mgaUpdateClipping(const GLcontext *ctx) } -static void mgaDDScissor( GLcontext *ctx, GLint x, GLint y, +static void mgaDDScissor( struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) { if ( ctx->Scissor.Enabled ) { @@ -338,7 +338,7 @@ static void mgaDDScissor( GLcontext *ctx, GLint x, GLint y, #define _CULL_NEGATIVE ((1<<11)|(1<<5)|(1<<16)) #define _CULL_POSITIVE (1<<11) -static void mgaDDCullFaceFrontFace(GLcontext *ctx, GLenum unused) +static void mgaDDCullFaceFrontFace(struct gl_context *ctx, GLenum unused) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -368,7 +368,7 @@ static void mgaDDCullFaceFrontFace(GLcontext *ctx, GLenum unused) * Masks */ -static void mgaDDColorMask(GLcontext *ctx, +static void mgaDDColorMask(struct gl_context *ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) { @@ -421,7 +421,7 @@ static int mgaStipples[16] = { * \param mask Pointer to the 32x32 stipple mask */ -static void mgaDDPolygonStipple( GLcontext *ctx, const GLubyte *mask ) +static void mgaDDPolygonStipple( struct gl_context *ctx, const GLubyte *mask ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); const GLubyte *m = mask; @@ -478,7 +478,7 @@ static void mgaDDPolygonStipple( GLcontext *ctx, const GLubyte *mask ) * sense to break them out of the core texture state update routines. */ -static void updateSpecularLighting( GLcontext *ctx ) +static void updateSpecularLighting( struct gl_context *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); unsigned int specen; @@ -497,7 +497,7 @@ static void updateSpecularLighting( GLcontext *ctx ) */ -static void mgaDDLightModelfv(GLcontext *ctx, GLenum pname, +static void mgaDDLightModelfv(struct gl_context *ctx, GLenum pname, const GLfloat *param) { if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) { @@ -513,7 +513,7 @@ static void mgaDDLightModelfv(GLcontext *ctx, GLenum pname, static void -mgaDDStencilFuncSeparate(GLcontext *ctx, GLenum face, GLenum func, GLint ref, +mgaDDStencilFuncSeparate(struct gl_context *ctx, GLenum face, GLenum func, GLint ref, GLuint mask) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -558,7 +558,7 @@ mgaDDStencilFuncSeparate(GLcontext *ctx, GLenum face, GLenum func, GLint ref, } static void -mgaDDStencilMaskSeparate(GLcontext *ctx, GLenum face, GLuint mask) +mgaDDStencilMaskSeparate(struct gl_context *ctx, GLenum face, GLuint mask) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -568,7 +568,7 @@ mgaDDStencilMaskSeparate(GLcontext *ctx, GLenum face, GLuint mask) } static void -mgaDDStencilOpSeparate(GLcontext *ctx, GLenum face, GLenum fail, GLenum zfail, +mgaDDStencilOpSeparate(struct gl_context *ctx, GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -676,7 +676,7 @@ mgaDDStencilOpSeparate(GLcontext *ctx, GLenum face, GLenum fail, GLenum zfail, * Window position and viewport transformation */ -void mgaCalcViewport( GLcontext *ctx ) +void mgaCalcViewport( struct gl_context *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); const GLfloat *v = ctx->Viewport._WindowMap.m; @@ -694,14 +694,14 @@ void mgaCalcViewport( GLcontext *ctx ) mmesa->SetupNewInputs = ~0; } -static void mgaViewport( GLcontext *ctx, +static void mgaViewport( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) { mgaCalcViewport( ctx ); } -static void mgaDepthRange( GLcontext *ctx, +static void mgaDepthRange( struct gl_context *ctx, GLclampd nearval, GLclampd farval ) { mgaCalcViewport( ctx ); @@ -712,7 +712,7 @@ static void mgaDepthRange( GLcontext *ctx, * Miscellaneous */ -static void mgaDDClearColor(GLcontext *ctx, +static void mgaDDClearColor(struct gl_context *ctx, const GLfloat color[4] ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -729,13 +729,13 @@ static void mgaDDClearColor(GLcontext *ctx, /* Fallback to swrast for select and feedback. */ -static void mgaRenderMode( GLcontext *ctx, GLenum mode ) +static void mgaRenderMode( struct gl_context *ctx, GLenum mode ) { FALLBACK( ctx, MGA_FALLBACK_RENDERMODE, (mode != GL_RENDER) ); } -static void mgaDDLogicOp( GLcontext *ctx, GLenum opcode ) +static void mgaDDLogicOp( struct gl_context *ctx, GLenum opcode ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); @@ -791,7 +791,7 @@ void mgaUpdateRects( mgaContextPtr mmesa, GLuint buffers ) } -static void mgaDDDrawBuffer(GLcontext *ctx, GLenum mode ) +static void mgaDDDrawBuffer(struct gl_context *ctx, GLenum mode ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -823,7 +823,7 @@ static void mgaDDDrawBuffer(GLcontext *ctx, GLenum mode ) } -static void mgaDDReadBuffer(GLcontext *ctx, GLenum mode ) +static void mgaDDReadBuffer(struct gl_context *ctx, GLenum mode ) { /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */ } @@ -834,7 +834,7 @@ static void mgaDDReadBuffer(GLcontext *ctx, GLenum mode ) */ -static void mgaDDEnable(GLcontext *ctx, GLenum cap, GLboolean state) +static void mgaDDEnable(struct gl_context *ctx, GLenum cap, GLboolean state) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); @@ -932,7 +932,7 @@ static void mgaDDPrintDirty( const char *msg, GLuint state ) void mgaEmitHwStateLocked( mgaContextPtr mmesa ) { drm_mga_sarea_t *sarea = mmesa->sarea; - GLcontext * ctx = mmesa->glCtx; + struct gl_context * ctx = mmesa->glCtx; if (MGA_DEBUG & DEBUG_VERBOSE_MSG) mgaDDPrintDirty( __FUNCTION__, mmesa->dirty ); @@ -1009,7 +1009,7 @@ void mgaEmitHwStateLocked( mgaContextPtr mmesa ) */ -static void mgaDDValidateState( GLcontext *ctx ) +static void mgaDDValidateState( struct gl_context *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); @@ -1033,7 +1033,7 @@ static void mgaDDValidateState( GLcontext *ctx ) } -static void mgaDDInvalidateState( GLcontext *ctx, GLuint new_state ) +static void mgaDDInvalidateState( struct gl_context *ctx, GLuint new_state ) { _swrast_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); @@ -1043,7 +1043,7 @@ static void mgaDDInvalidateState( GLcontext *ctx, GLuint new_state ) } -static void mgaRunPipeline( GLcontext *ctx ) +static void mgaRunPipeline( struct gl_context *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -1062,7 +1062,7 @@ static void mgaRunPipeline( GLcontext *ctx ) void mgaInitState( mgaContextPtr mmesa ) { mgaScreenPrivate *mgaScreen = mmesa->mgaScreen; - GLcontext *ctx = mmesa->glCtx; + struct gl_context *ctx = mmesa->glCtx; if (ctx->Visual.doubleBufferMode) { /* use back buffer by default */ @@ -1161,7 +1161,7 @@ void mgaInitState( mgaContextPtr mmesa ) } -void mgaDDInitStateFuncs( GLcontext *ctx ) +void mgaDDInitStateFuncs( struct gl_context *ctx ) { ctx->Driver.UpdateState = mgaDDInvalidateState; ctx->Driver.Enable = mgaDDEnable; diff --git a/src/mesa/drivers/dri/mga/mgastate.h b/src/mesa/drivers/dri/mga/mgastate.h index ec65d4e6cd..6e8a869cf7 100644 --- a/src/mesa/drivers/dri/mga/mgastate.h +++ b/src/mesa/drivers/dri/mga/mgastate.h @@ -29,10 +29,10 @@ #define _MGA_STATE_H extern void mgaInitState( mgaContextPtr mmesa ); -extern void mgaDDInitStateFuncs(GLcontext *ctx); -extern void mgaUpdateClipping(const GLcontext *ctx); -extern void mgaUpdateCull( GLcontext *ctx ); -extern void mgaCalcViewport( GLcontext *ctx ); +extern void mgaDDInitStateFuncs(struct gl_context *ctx); +extern void mgaUpdateClipping(const struct gl_context *ctx); +extern void mgaUpdateCull( struct gl_context *ctx ); +extern void mgaCalcViewport( struct gl_context *ctx ); extern void mgaUpdateRects( mgaContextPtr mmesa, GLuint buffers ); #endif diff --git a/src/mesa/drivers/dri/mga/mgatex.c b/src/mesa/drivers/dri/mga/mgatex.c index ca3dd4b013..11ab9b6117 100644 --- a/src/mesa/drivers/dri/mga/mgatex.c +++ b/src/mesa/drivers/dri/mga/mgatex.c @@ -161,7 +161,7 @@ static void mgaSetTexBorderColor(mgaTextureObjectPtr t, const GLfloat color[4]) static gl_format -mgaChooseTextureFormat( GLcontext *ctx, GLint internalFormat, +mgaChooseTextureFormat( struct gl_context *ctx, GLint internalFormat, GLenum format, GLenum type ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -336,7 +336,7 @@ mgaAllocTexObj( struct gl_texture_object *tObj ) } -static void mgaTexEnv( GLcontext *ctx, GLenum target, +static void mgaTexEnv( struct gl_context *ctx, GLenum target, GLenum pname, const GLfloat *param ) { GLuint unit = ctx->Texture.CurrentUnit; @@ -355,7 +355,7 @@ static void mgaTexEnv( GLcontext *ctx, GLenum target, } -static void mgaTexImage2D( GLcontext *ctx, GLenum target, GLint level, +static void mgaTexImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -384,7 +384,7 @@ static void mgaTexImage2D( GLcontext *ctx, GLenum target, GLint level, t->dirty_images[0] |= (1UL << level); } -static void mgaTexSubImage2D( GLcontext *ctx, +static void mgaTexSubImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -424,7 +424,7 @@ static void mgaTexSubImage2D( GLcontext *ctx, */ static void -mgaTexParameter( GLcontext *ctx, GLenum target, +mgaTexParameter( struct gl_context *ctx, GLenum target, struct gl_texture_object *tObj, GLenum pname, const GLfloat *params ) { @@ -480,7 +480,7 @@ mgaTexParameter( GLcontext *ctx, GLenum target, static void -mgaBindTexture( GLcontext *ctx, GLenum target, +mgaBindTexture( struct gl_context *ctx, GLenum target, struct gl_texture_object *tObj ) { assert( (target != GL_TEXTURE_2D && target != GL_TEXTURE_RECTANGLE_NV) || @@ -489,7 +489,7 @@ mgaBindTexture( GLcontext *ctx, GLenum target, static void -mgaDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj ) +mgaDeleteTexture( struct gl_context *ctx, struct gl_texture_object *tObj ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); driTextureObject * t = (driTextureObject *) tObj->DriverData; @@ -516,7 +516,7 @@ mgaDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj ) * texture object from the core mesa gl_texture_object. Not done at this time. */ static struct gl_texture_object * -mgaNewTextureObject( GLcontext *ctx, GLuint name, GLenum target ) +mgaNewTextureObject( struct gl_context *ctx, GLuint name, GLenum target ) { struct gl_texture_object *obj; obj = _mesa_new_texture_object(ctx, name, target); diff --git a/src/mesa/drivers/dri/mga/mgatex.h b/src/mesa/drivers/dri/mga/mgatex.h index 789034964a..3827fb0668 100644 --- a/src/mesa/drivers/dri/mga/mgatex.h +++ b/src/mesa/drivers/dri/mga/mgatex.h @@ -37,7 +37,7 @@ typedef struct mga_texture_object_s *mgaTextureObjectPtr; * state is properly setup. Texture residence is checked later * when we grab the lock. */ -void mgaUpdateTextureState( GLcontext *ctx ); +void mgaUpdateTextureState( struct gl_context *ctx ); int mgaUploadTexImages( mgaContextPtr mmesa, mgaTextureObjectPtr t ); @@ -45,6 +45,6 @@ void mgaDestroyTexObj( mgaContextPtr mmesa, mgaTextureObjectPtr t ); void mgaInitTextureFuncs( struct dd_function_table *functions ); -GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit ); +GLboolean mgaUpdateTextureEnvCombine( struct gl_context *ctx, int unit ); #endif diff --git a/src/mesa/drivers/dri/mga/mgatris.c b/src/mesa/drivers/dri/mga/mgatris.c index 07cf682f6e..7b06774adb 100644 --- a/src/mesa/drivers/dri/mga/mgatris.c +++ b/src/mesa/drivers/dri/mga/mgatris.c @@ -40,7 +40,7 @@ #include "mgavb.h" -static void mgaRenderPrimitive( GLcontext *ctx, GLenum prim ); +static void mgaRenderPrimitive( struct gl_context *ctx, GLenum prim ); /*********************************************************************** * Functions to draw basic primitives * @@ -285,7 +285,7 @@ mga_fallback_tri( mgaContextPtr mmesa, mgaVertex *v1, mgaVertex *v2 ) { - GLcontext *ctx = mmesa->glCtx; + struct gl_context *ctx = mmesa->glCtx; SWvertex v[3]; mga_translate_vertex( ctx, v0, &v[0] ); mga_translate_vertex( ctx, v1, &v[1] ); @@ -299,7 +299,7 @@ mga_fallback_line( mgaContextPtr mmesa, mgaVertex *v0, mgaVertex *v1 ) { - GLcontext *ctx = mmesa->glCtx; + struct gl_context *ctx = mmesa->glCtx; SWvertex v[2]; mga_translate_vertex( ctx, v0, &v[0] ); mga_translate_vertex( ctx, v1, &v[1] ); @@ -311,7 +311,7 @@ static void mga_fallback_point( mgaContextPtr mmesa, mgaVertex *v0 ) { - GLcontext *ctx = mmesa->glCtx; + struct gl_context *ctx = mmesa->glCtx; SWvertex v[1]; mga_translate_vertex( ctx, v0, &v[0] ); _swrast_Point( ctx, &v[0] ); @@ -630,7 +630,7 @@ static void init_rast_tab( void ) -static void mgaRenderClippedPoly( GLcontext *ctx, const GLuint *elts, GLuint n ) +static void mgaRenderClippedPoly( struct gl_context *ctx, const GLuint *elts, GLuint n ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -652,13 +652,13 @@ static void mgaRenderClippedPoly( GLcontext *ctx, const GLuint *elts, GLuint n ) tnl->Driver.Render.PrimitiveNotify( ctx, prim ); } -static void mgaRenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) +static void mgaRenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->Driver.Render.Line( ctx, ii, jj ); } -static void mgaFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, +static void mgaFastRenderClippedPoly( struct gl_context *ctx, const GLuint *elts, GLuint n ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); @@ -687,7 +687,7 @@ static void mgaFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, #define ANY_RASTER_FLAGS (DD_FLATSHADE|DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET| \ DD_TRI_UNFILLED) -void mgaChooseRenderState(GLcontext *ctx) +void mgaChooseRenderState(struct gl_context *ctx) { TNLcontext *tnl = TNL_CONTEXT(ctx); mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -773,7 +773,7 @@ static GLenum reduced_prim[GL_POLYGON+1] = { /* Always called between RenderStart and RenderFinish --> We already * hold the lock. */ -void mgaRasterPrimitive( GLcontext *ctx, GLenum prim, GLuint hwprim ) +void mgaRasterPrimitive( struct gl_context *ctx, GLenum prim, GLuint hwprim ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); @@ -806,7 +806,7 @@ void mgaRasterPrimitive( GLcontext *ctx, GLenum prim, GLuint hwprim ) * which renders strips as strips, the equivalent calculations are * performed in mgarender.c. */ -static void mgaRenderPrimitive( GLcontext *ctx, GLenum prim ) +static void mgaRenderPrimitive( struct gl_context *ctx, GLenum prim ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); GLuint rprim = reduced_prim[prim]; @@ -821,7 +821,7 @@ static void mgaRenderPrimitive( GLcontext *ctx, GLenum prim ) } } -static void mgaRenderFinish( GLcontext *ctx ) +static void mgaRenderFinish( struct gl_context *ctx ) { if (MGA_CONTEXT(ctx)->RenderIndex & MGA_FALLBACK_BIT) _swrast_flush( ctx ); @@ -856,7 +856,7 @@ static const char *getFallbackString(GLuint bit) } -void mgaFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) +void mgaFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ) { TNLcontext *tnl = TNL_CONTEXT(ctx); mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -893,7 +893,7 @@ void mgaFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) } -void mgaDDInitTriFuncs( GLcontext *ctx ) +void mgaDDInitTriFuncs( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); mgaContextPtr mmesa = MGA_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/mga/mgatris.h b/src/mesa/drivers/dri/mga/mgatris.h index 43612b80a1..2f574feb93 100644 --- a/src/mesa/drivers/dri/mga/mgatris.h +++ b/src/mesa/drivers/dri/mga/mgatris.h @@ -30,11 +30,11 @@ #include "main/mtypes.h" -extern void mgaDDInitTriFuncs( GLcontext *ctx ); -extern void mgaChooseRenderState( GLcontext *ctx ); -extern void mgaRasterPrimitive( GLcontext *ctx, GLenum prim, GLuint hwprim ); +extern void mgaDDInitTriFuncs( struct gl_context *ctx ); +extern void mgaChooseRenderState( struct gl_context *ctx ); +extern void mgaRasterPrimitive( struct gl_context *ctx, GLenum prim, GLuint hwprim ); -extern void mgaFallback( GLcontext *ctx, GLuint bit, GLboolean mode ); +extern void mgaFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ); #define FALLBACK( ctx, bit, mode ) mgaFallback( ctx, bit, mode ) #define _MGA_NEW_RENDERSTATE (_DD_NEW_POINT_SMOOTH | \ diff --git a/src/mesa/drivers/dri/mga/mgavb.c b/src/mesa/drivers/dri/mga/mgavb.c index 71bbf33f23..f098aa5cbc 100644 --- a/src/mesa/drivers/dri/mga/mgavb.c +++ b/src/mesa/drivers/dri/mga/mgavb.c @@ -52,10 +52,10 @@ #define MGA_MAX_SETUP 0x80 static struct { - void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint ); + void (*emit)( struct gl_context *, GLuint, GLuint, void *, GLuint ); tnl_interp_func interp; tnl_copy_pv_func copy_pv; - GLboolean (*check_tex_sizes)( GLcontext *ctx ); + GLboolean (*check_tex_sizes)( struct gl_context *ctx ); GLuint vertex_size; GLuint vertex_format; } setup_tab[MGA_MAX_SETUP]; @@ -316,7 +316,7 @@ void mgaPrintSetupFlags(char *msg, GLuint flags ) } -void mgaCheckTexSizes( GLcontext *ctx ) +void mgaCheckTexSizes( struct gl_context *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -339,7 +339,7 @@ void mgaCheckTexSizes( GLcontext *ctx ) } -void mgaBuildVertices( GLcontext *ctx, +void mgaBuildVertices( struct gl_context *ctx, GLuint start, GLuint count, GLuint newinputs ) @@ -386,7 +386,7 @@ void mgaBuildVertices( GLcontext *ctx, } -void mgaChooseVertexState( GLcontext *ctx ) +void mgaChooseVertexState( struct gl_context *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -433,7 +433,7 @@ void mgaChooseVertexState( GLcontext *ctx ) -void *mga_emit_contiguous_verts( GLcontext *ctx, +void *mga_emit_contiguous_verts( struct gl_context *ctx, GLuint start, GLuint count, void *dest) @@ -446,7 +446,7 @@ void *mga_emit_contiguous_verts( GLcontext *ctx, -void mgaInitVB( GLcontext *ctx ) +void mgaInitVB( struct gl_context *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); GLuint size = TNL_CONTEXT(ctx)->vb.Size; @@ -467,7 +467,7 @@ void mgaInitVB( GLcontext *ctx ) } -void mgaFreeVB( GLcontext *ctx ) +void mgaFreeVB( struct gl_context *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); if (mmesa->verts) { diff --git a/src/mesa/drivers/dri/mga/mgavb.h b/src/mesa/drivers/dri/mga/mgavb.h index 8d24ab7b5f..20e5d8ba70 100644 --- a/src/mesa/drivers/dri/mga/mgavb.h +++ b/src/mesa/drivers/dri/mga/mgavb.h @@ -39,27 +39,27 @@ _NEW_FOG) -extern void mgaChooseVertexState( GLcontext *ctx ); -extern void mgaCheckTexSizes( GLcontext *ctx ); -extern void mgaBuildVertices( GLcontext *ctx, +extern void mgaChooseVertexState( struct gl_context *ctx ); +extern void mgaCheckTexSizes( struct gl_context *ctx ); +extern void mgaBuildVertices( struct gl_context *ctx, GLuint start, GLuint count, GLuint newinputs ); extern void mgaPrintSetupFlags(char *msg, GLuint flags ); -extern void mgaInitVB( GLcontext *ctx ); -extern void mgaFreeVB( GLcontext *ctx ); +extern void mgaInitVB( struct gl_context *ctx ); +extern void mgaFreeVB( struct gl_context *ctx ); -extern void *mga_emit_contiguous_verts( GLcontext *ctx, +extern void *mga_emit_contiguous_verts( struct gl_context *ctx, GLuint start, GLuint count, void *dest ); -extern void mga_translate_vertex(GLcontext *ctx, +extern void mga_translate_vertex(struct gl_context *ctx, const mgaVertex *src, SWvertex *dst); -extern void mga_print_vertex( GLcontext *ctx, const mgaVertex *v ); +extern void mga_print_vertex( struct gl_context *ctx, const mgaVertex *v ); #endif diff --git a/src/mesa/drivers/dri/nouveau/nouveau_bo_state.c b/src/mesa/drivers/dri/nouveau/nouveau_bo_state.c index fc5f77b46a..f31772fe1d 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_bo_state.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_bo_state.c @@ -28,7 +28,7 @@ #include "nouveau_context.h" static GLboolean -nouveau_bo_marker_emit(GLcontext *ctx, struct nouveau_bo_marker *m, +nouveau_bo_marker_emit(struct gl_context *ctx, struct nouveau_bo_marker *m, uint32_t flags) { struct nouveau_channel *chan = context_chan(ctx); @@ -136,7 +136,7 @@ nouveau_bo_context_reset(struct nouveau_bo_context *bctx) } GLboolean -nouveau_bo_state_emit(GLcontext *ctx) +nouveau_bo_state_emit(struct gl_context *ctx) { struct nouveau_bo_state *s = &to_nouveau_context(ctx)->bo; int i, j; @@ -155,7 +155,7 @@ nouveau_bo_state_emit(GLcontext *ctx) } void -nouveau_bo_state_init(GLcontext *ctx) +nouveau_bo_state_init(struct gl_context *ctx) { struct nouveau_bo_state *s = &to_nouveau_context(ctx)->bo; int i; @@ -165,7 +165,7 @@ nouveau_bo_state_init(GLcontext *ctx) } void -nouveau_bo_state_destroy(GLcontext *ctx) +nouveau_bo_state_destroy(struct gl_context *ctx) { struct nouveau_bo_state *s = &to_nouveau_context(ctx)->bo; int i, j; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_bo_state.h b/src/mesa/drivers/dri/nouveau/nouveau_bo_state.h index da0a3a5c6f..6119a8336e 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_bo_state.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_bo_state.h @@ -52,7 +52,7 @@ struct nouveau_bo_marker { }; struct nouveau_bo_context { - GLcontext *ctx; + struct gl_context *ctx; struct nouveau_bo_marker *marker; int allocated; @@ -84,13 +84,13 @@ void nouveau_bo_context_reset(struct nouveau_bo_context *bctx); GLboolean -nouveau_bo_state_emit(GLcontext *ctx); +nouveau_bo_state_emit(struct gl_context *ctx); void -nouveau_bo_state_init(GLcontext *ctx); +nouveau_bo_state_init(struct gl_context *ctx); void -nouveau_bo_state_destroy(GLcontext *ctx); +nouveau_bo_state_destroy(struct gl_context *ctx); #define __context_bctx(ctx, i) \ ({ \ diff --git a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c index 5906ad6d39..ad6e5bd805 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c @@ -31,7 +31,7 @@ #include "main/bufferobj.h" static struct gl_buffer_object * -nouveau_bufferobj_new(GLcontext *ctx, GLuint buffer, GLenum target) +nouveau_bufferobj_new(struct gl_context *ctx, GLuint buffer, GLenum target) { struct nouveau_bufferobj *nbo; @@ -45,7 +45,7 @@ nouveau_bufferobj_new(GLcontext *ctx, GLuint buffer, GLenum target) } static void -nouveau_bufferobj_del(GLcontext *ctx, struct gl_buffer_object *obj) +nouveau_bufferobj_del(struct gl_context *ctx, struct gl_buffer_object *obj) { struct nouveau_bufferobj *nbo = to_nouveau_bufferobj(obj); @@ -54,7 +54,7 @@ nouveau_bufferobj_del(GLcontext *ctx, struct gl_buffer_object *obj) } static GLboolean -nouveau_bufferobj_data(GLcontext *ctx, GLenum target, GLsizeiptrARB size, +nouveau_bufferobj_data(struct gl_context *ctx, GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage, struct gl_buffer_object *obj) { @@ -80,7 +80,7 @@ nouveau_bufferobj_data(GLcontext *ctx, GLenum target, GLsizeiptrARB size, } static void -nouveau_bufferobj_subdata(GLcontext *ctx, GLenum target, GLintptrARB offset, +nouveau_bufferobj_subdata(struct gl_context *ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data, struct gl_buffer_object *obj) { @@ -92,7 +92,7 @@ nouveau_bufferobj_subdata(GLcontext *ctx, GLenum target, GLintptrARB offset, } static void -nouveau_bufferobj_get_subdata(GLcontext *ctx, GLenum target, GLintptrARB offset, +nouveau_bufferobj_get_subdata(struct gl_context *ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data, struct gl_buffer_object *obj) { @@ -104,7 +104,7 @@ nouveau_bufferobj_get_subdata(GLcontext *ctx, GLenum target, GLintptrARB offset, } static void * -nouveau_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access, +nouveau_bufferobj_map(struct gl_context *ctx, GLenum target, GLenum access, struct gl_buffer_object *obj) { return ctx->Driver.MapBufferRange(ctx, target, 0, obj->Size, access, @@ -112,7 +112,7 @@ nouveau_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access, } static void * -nouveau_bufferobj_map_range(GLcontext *ctx, GLenum target, GLintptr offset, +nouveau_bufferobj_map_range(struct gl_context *ctx, GLenum target, GLintptr offset, GLsizeiptr length, GLenum access, struct gl_buffer_object *obj) { @@ -142,7 +142,7 @@ nouveau_bufferobj_map_range(GLcontext *ctx, GLenum target, GLintptr offset, } static GLboolean -nouveau_bufferobj_unmap(GLcontext *ctx, GLenum target, struct gl_buffer_object *obj) +nouveau_bufferobj_unmap(struct gl_context *ctx, GLenum target, struct gl_buffer_object *obj) { struct nouveau_bufferobj *nbo = to_nouveau_bufferobj(obj); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_class.h b/src/mesa/drivers/dri/nouveau/nouveau_class.h index 5cb13acf7b..d41d431f79 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_class.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_class.h @@ -3191,6 +3191,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define NV17TCL_DMA_IN_MEMORY4 0x000001ac #define NV17TCL_DMA_IN_MEMORY5 0x000001b0 #define NV17TCL_COLOR_MASK_ENABLE 0x000002bc +#define NV17TCL_ZCLEAR_ENABLE 0x000003f8 +#define NV17TCL_ZCLEAR_VALUE 0x000003fc +#define NV17TCL_ZCLEAR_VALUE_DEPTH_SHIFT 8 +#define NV17TCL_ZCLEAR_VALUE_DEPTH_MASK 0xffffff00 +#define NV17TCL_ZCLEAR_VALUE_SEQUENCE_SHIFT 0 +#define NV17TCL_ZCLEAR_VALUE_SEQUENCE_MASK 0x000000ff #define NV17TCL_LMA_DEPTH_BUFFER_PITCH 0x00000d5c #define NV17TCL_LMA_DEPTH_BUFFER_OFFSET 0x00000d60 #define NV17TCL_LMA_DEPTH_FILL_VALUE 0x00000d68 diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index eff1016c07..d3e2c0df6c 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -62,7 +62,6 @@ static const struct dri_extension nouveau_extensions[] = { { "GL_EXT_texture_lod_bias", NULL }, { "GL_NV_blend_square", NULL }, { "GL_NV_texture_env_combine4", NULL }, - { "GL_SGIS_generate_mipmap", NULL }, { NULL, NULL } }; @@ -70,7 +69,7 @@ static void nouveau_channel_flush_notify(struct nouveau_channel *chan) { struct nouveau_context *nctx = chan->user_private; - GLcontext *ctx = &nctx->base; + struct gl_context *ctx = &nctx->base; if (nctx->fallback < SWRAST) nouveau_bo_state_emit(ctx); @@ -78,13 +77,13 @@ nouveau_channel_flush_notify(struct nouveau_channel *chan) GLboolean nouveau_context_create(gl_api api, - const __GLcontextModes *visual, __DRIcontext *dri_ctx, + const struct gl_config *visual, __DRIcontext *dri_ctx, void *share_ctx) { __DRIscreen *dri_screen = dri_ctx->driScreenPriv; struct nouveau_screen *screen = dri_screen->private; struct nouveau_context *nctx; - GLcontext *ctx; + struct gl_context *ctx; ctx = screen->driver->context_create(screen, visual, share_ctx); if (!ctx) @@ -98,8 +97,8 @@ nouveau_context_create(gl_api api, } GLboolean -nouveau_context_init(GLcontext *ctx, struct nouveau_screen *screen, - const GLvisual *visual, GLcontext *share_ctx) +nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen, + const struct gl_config *visual, struct gl_context *share_ctx) { struct nouveau_context *nctx = to_nouveau_context(ctx); struct dd_function_table functions; @@ -129,7 +128,7 @@ nouveau_context_init(GLcontext *ctx, struct nouveau_screen *screen, /* Allocate a hardware channel. */ ret = nouveau_channel_alloc(context_dev(ctx), 0xbeef0201, 0xbeef0202, - &nctx->hw.chan); + 512*1024, &nctx->hw.chan); if (ret) { nouveau_error("Error initializing the FIFO.\n"); return GL_FALSE; @@ -145,7 +144,7 @@ nouveau_context_init(GLcontext *ctx, struct nouveau_screen *screen, } void -nouveau_context_deinit(GLcontext *ctx) +nouveau_context_deinit(struct gl_context *ctx) { struct nouveau_context *nctx = to_nouveau_context(ctx); @@ -172,7 +171,7 @@ void nouveau_context_destroy(__DRIcontext *dri_ctx) { struct nouveau_context *nctx = dri_ctx->driverPrivate; - GLcontext *ctx = &nctx->base; + struct gl_context *ctx = &nctx->base; context_drv(ctx)->context_destroy(ctx); } @@ -180,7 +179,7 @@ nouveau_context_destroy(__DRIcontext *dri_ctx) void nouveau_update_renderbuffers(__DRIcontext *dri_ctx, __DRIdrawable *draw) { - GLcontext *ctx = dri_ctx->driverPrivate; + struct gl_context *ctx = dri_ctx->driverPrivate; __DRIscreen *screen = dri_ctx->driScreenPriv; struct gl_framebuffer *fb = draw->driverPrivate; struct nouveau_framebuffer *nfb = to_nouveau_framebuffer(fb); @@ -254,7 +253,7 @@ static void update_framebuffer(__DRIcontext *dri_ctx, __DRIdrawable *draw, int *stamp) { - GLcontext *ctx = dri_ctx->driverPrivate; + struct gl_context *ctx = dri_ctx->driverPrivate; struct gl_framebuffer *fb = draw->driverPrivate; *stamp = *draw->pStamp; @@ -262,7 +261,10 @@ update_framebuffer(__DRIcontext *dri_ctx, __DRIdrawable *draw, nouveau_update_renderbuffers(dri_ctx, draw); _mesa_resize_framebuffer(ctx, fb, draw->w, draw->h); + /* Clean up references to the old framebuffer objects. */ context_dirty(ctx, FRAMEBUFFER); + context_bctx(ctx, FRAMEBUFFER); + FIRE_RING(context_chan(ctx)); } GLboolean @@ -271,7 +273,7 @@ nouveau_context_make_current(__DRIcontext *dri_ctx, __DRIdrawable *dri_draw, { if (dri_ctx) { struct nouveau_context *nctx = dri_ctx->driverPrivate; - GLcontext *ctx = &nctx->base; + struct gl_context *ctx = &nctx->base; /* Ask the X server for new renderbuffers. */ if (dri_draw->driverPrivate != ctx->WinSysDrawBuffer) @@ -283,10 +285,6 @@ nouveau_context_make_current(__DRIcontext *dri_ctx, __DRIdrawable *dri_draw, update_framebuffer(dri_ctx, dri_read, &dri_ctx->dri2.read_stamp); - /* Clean up references to the old framebuffer objects. */ - context_bctx(ctx, FRAMEBUFFER); - FIRE_RING(context_chan(ctx)); - /* Pass it down to mesa. */ _mesa_make_current(ctx, dri_draw->driverPrivate, dri_read->driverPrivate); @@ -309,7 +307,7 @@ nouveau_context_unbind(__DRIcontext *dri_ctx) } void -nouveau_fallback(GLcontext *ctx, enum nouveau_fallback mode) +nouveau_fallback(struct gl_context *ctx, enum nouveau_fallback mode) { struct nouveau_context *nctx = to_nouveau_context(ctx); @@ -341,7 +339,7 @@ validate_framebuffer(__DRIcontext *dri_ctx, __DRIdrawable *draw, } void -nouveau_validate_framebuffer(GLcontext *ctx) +nouveau_validate_framebuffer(struct gl_context *ctx) { __DRIcontext *dri_ctx = to_nouveau_context(ctx)->dri_context; __DRIdrawable *dri_draw = dri_ctx->driDrawablePriv; @@ -355,8 +353,5 @@ nouveau_validate_framebuffer(GLcontext *ctx) validate_framebuffer(dri_ctx, dri_read, &dri_ctx->dri2.read_stamp); - if (nouveau_next_dirty_state(ctx) >= 0) { - nouveau_state_emit(ctx); - FIRE_RING(context_chan(ctx)); - } + nouveau_state_emit(ctx); } diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.h b/src/mesa/drivers/dri/nouveau/nouveau_context.h index 3dbe72900a..23a8725672 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h @@ -57,7 +57,7 @@ struct nouveau_hw_state { }; struct nouveau_context { - GLcontext base; + struct gl_context base; __DRIcontext *dri_context; struct nouveau_screen *screen; @@ -67,6 +67,11 @@ struct nouveau_context { struct nouveau_hw_state hw; struct nouveau_bo_state bo; struct nouveau_render_state render; + + struct { + GLboolean clear_blocked; + int clear_seq; + } hierz; }; #define to_nouveau_context(ctx) ((struct nouveau_context *)(ctx)) @@ -90,15 +95,15 @@ struct nouveau_context { GLboolean nouveau_context_create(gl_api api, - const __GLcontextModes *visual, __DRIcontext *dri_ctx, + const struct gl_config *visual, __DRIcontext *dri_ctx, void *share_ctx); GLboolean -nouveau_context_init(GLcontext *ctx, struct nouveau_screen *screen, - const GLvisual *visual, GLcontext *share_ctx); +nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen, + const struct gl_config *visual, struct gl_context *share_ctx); void -nouveau_context_deinit(GLcontext *ctx); +nouveau_context_deinit(struct gl_context *ctx); void nouveau_context_destroy(__DRIcontext *dri_ctx); @@ -114,10 +119,10 @@ GLboolean nouveau_context_unbind(__DRIcontext *dri_ctx); void -nouveau_fallback(GLcontext *ctx, enum nouveau_fallback mode); +nouveau_fallback(struct gl_context *ctx, enum nouveau_fallback mode); void -nouveau_validate_framebuffer(GLcontext *ctx); +nouveau_validate_framebuffer(struct gl_context *ctx); #endif diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c b/src/mesa/drivers/dri/nouveau/nouveau_driver.c index 6452fe218e..27e2892f71 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c @@ -32,7 +32,7 @@ #include "drivers/common/meta.h" static const GLubyte * -nouveau_get_string(GLcontext *ctx, GLenum name) +nouveau_get_string(struct gl_context *ctx, GLenum name) { static char buffer[128]; char hardware_name[32]; @@ -52,7 +52,7 @@ nouveau_get_string(GLcontext *ctx, GLenum name) } static void -nouveau_flush(GLcontext *ctx) +nouveau_flush(struct gl_context *ctx) { struct nouveau_context *nctx = to_nouveau_context(ctx); struct nouveau_channel *chan = context_chan(ctx); @@ -70,13 +70,13 @@ nouveau_flush(GLcontext *ctx) } static void -nouveau_finish(GLcontext *ctx) +nouveau_finish(struct gl_context *ctx) { nouveau_flush(ctx); } void -nouveau_clear(GLcontext *ctx, GLbitfield buffers) +nouveau_clear(struct gl_context *ctx, GLbitfield buffers) { struct gl_framebuffer *fb = ctx->DrawBuffer; int x, y, w, h; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.h b/src/mesa/drivers/dri/nouveau/nouveau_driver.h index 283f6eac2c..8036b18edc 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_driver.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.h @@ -51,16 +51,16 @@ #define DRIVER_AUTHOR "Nouveau" struct nouveau_driver { - GLcontext *(*context_create)(struct nouveau_screen *screen, - const GLvisual *visual, - GLcontext *share_ctx); - void (*context_destroy)(GLcontext *ctx); + struct gl_context *(*context_create)(struct nouveau_screen *screen, + const struct gl_config *visual, + struct gl_context *share_ctx); + void (*context_destroy)(struct gl_context *ctx); - void (*surface_copy)(GLcontext *ctx, + void (*surface_copy)(struct gl_context *ctx, struct nouveau_surface *dst, struct nouveau_surface *src, int dx, int dy, int sx, int sy, int w, int h); - void (*surface_fill)(GLcontext *ctx, + void (*surface_fill)(struct gl_context *ctx, struct nouveau_surface *dst, unsigned mask, unsigned value, int dx, int dy, int w, int h); @@ -73,10 +73,10 @@ struct nouveau_driver { fprintf(stderr, "%s: " format, __func__, ## __VA_ARGS__) void -nouveau_clear(GLcontext *ctx, GLbitfield buffers); +nouveau_clear(struct gl_context *ctx, GLbitfield buffers); void -nouveau_span_functions_init(GLcontext *ctx); +nouveau_span_functions_init(struct gl_context *ctx); void nouveau_driver_functions_init(struct dd_function_table *functions); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c index f0caf4c629..079b5d63e4 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c @@ -86,7 +86,7 @@ set_renderbuffer_format(struct gl_renderbuffer *rb, GLenum internalFormat) } static GLboolean -nouveau_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, +nouveau_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { @@ -115,7 +115,7 @@ nouveau_renderbuffer_del(struct gl_renderbuffer *rb) } static struct gl_renderbuffer * -nouveau_renderbuffer_new(GLcontext *ctx, GLuint name) +nouveau_renderbuffer_new(struct gl_context *ctx, GLuint name) { struct gl_renderbuffer *rb; @@ -133,7 +133,7 @@ nouveau_renderbuffer_new(GLcontext *ctx, GLuint name) } static GLboolean -nouveau_renderbuffer_dri_storage(GLcontext *ctx, struct gl_renderbuffer *rb, +nouveau_renderbuffer_dri_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { @@ -166,7 +166,7 @@ nouveau_renderbuffer_dri_new(GLenum format, __DRIdrawable *drawable) } static struct gl_framebuffer * -nouveau_framebuffer_new(GLcontext *ctx, GLuint name) +nouveau_framebuffer_new(struct gl_context *ctx, GLuint name) { struct nouveau_framebuffer *nfb; @@ -180,7 +180,7 @@ nouveau_framebuffer_new(GLcontext *ctx, GLuint name) } struct gl_framebuffer * -nouveau_framebuffer_dri_new(const GLvisual *visual) +nouveau_framebuffer_dri_new(const struct gl_config *visual) { struct nouveau_framebuffer *nfb; @@ -195,7 +195,7 @@ nouveau_framebuffer_dri_new(const GLvisual *visual) } static void -nouveau_bind_framebuffer(GLcontext *ctx, GLenum target, +nouveau_bind_framebuffer(struct gl_context *ctx, GLenum target, struct gl_framebuffer *dfb, struct gl_framebuffer *rfb) { @@ -203,7 +203,7 @@ nouveau_bind_framebuffer(GLcontext *ctx, GLenum target, } static void -nouveau_framebuffer_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, +nouveau_framebuffer_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb, GLenum attachment, struct gl_renderbuffer *rb) { _mesa_framebuffer_renderbuffer(ctx, fb, attachment, rb); @@ -227,7 +227,7 @@ get_tex_format(struct gl_texture_image *ti) } static void -nouveau_render_texture(GLcontext *ctx, struct gl_framebuffer *fb, +nouveau_render_texture(struct gl_context *ctx, struct gl_framebuffer *fb, struct gl_renderbuffer_attachment *att) { struct gl_renderbuffer *rb = att->Renderbuffer; @@ -255,7 +255,7 @@ nouveau_render_texture(GLcontext *ctx, struct gl_framebuffer *fb, } static void -nouveau_finish_render_texture(GLcontext *ctx, +nouveau_finish_render_texture(struct gl_context *ctx, struct gl_renderbuffer_attachment *att) { texture_dirty(att->Texture); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.h b/src/mesa/drivers/dri/nouveau/nouveau_fbo.h index 0fe6c08be5..b1d5d8da45 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.h @@ -29,8 +29,12 @@ struct nouveau_framebuffer { struct gl_framebuffer base; - struct nouveau_bo *lma_bo; GLboolean need_front; + + struct { + struct nouveau_bo *bo; + uint32_t clear_value; + } hierz; }; #define to_nouveau_framebuffer(x) ((struct nouveau_framebuffer *)(x)) @@ -41,7 +45,7 @@ struct nouveau_renderbuffer { #define to_nouveau_renderbuffer(x) ((struct nouveau_renderbuffer *)(x)) struct gl_framebuffer * -nouveau_framebuffer_dri_new(const GLvisual *visual); +nouveau_framebuffer_dri_new(const struct gl_config *visual); struct gl_renderbuffer * nouveau_renderbuffer_dri_new(GLenum format, __DRIdrawable *drawable); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_render.h b/src/mesa/drivers/dri/nouveau/nouveau_render.h index 923b79b2cf..81c6119fcc 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_render.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_render.h @@ -31,7 +31,7 @@ struct nouveau_array_state; -typedef void (*dispatch_t)(GLcontext *, unsigned int, int, unsigned int); +typedef void (*dispatch_t)(struct gl_context *, unsigned int, int, unsigned int); typedef unsigned (*extract_u_t)(struct nouveau_array_state *, int, int); typedef float (*extract_f_t)(struct nouveau_array_state *, int, int); @@ -40,7 +40,7 @@ struct nouveau_attr_info { int imm_method; int imm_fields; - void (*emit)(GLcontext *, struct nouveau_array_state *, const void *); + void (*emit)(struct gl_context *, struct nouveau_array_state *, const void *); }; struct nouveau_array_state { @@ -55,8 +55,8 @@ struct nouveau_array_state { extract_f_t extract_f; }; -#define RENDER_SCRATCH_COUNT 32 -#define RENDER_SCRATCH_SIZE 64*1024 +#define RENDER_SCRATCH_COUNT 2 +#define RENDER_SCRATCH_SIZE 2*1024*1024 struct nouveau_scratch_state { struct nouveau_bo *bo[RENDER_SCRATCH_COUNT]; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_render_t.c b/src/mesa/drivers/dri/nouveau/nouveau_render_t.c index 7ccd7e6416..dd38c14aa7 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_render_t.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_render_t.c @@ -104,9 +104,9 @@ static void get_array_dispatch(struct nouveau_array_state *a, dispatch_t *dispatch) { if (!a->fields) { - auto void f(GLcontext *, unsigned int, int, unsigned int); + auto void f(struct gl_context *, unsigned int, int, unsigned int); - void f(GLcontext *ctx, unsigned int start, int delta, + void f(struct gl_context *ctx, unsigned int start, int delta, unsigned int n) { struct nouveau_channel *chan = context_chan(ctx); RENDER_LOCALS(ctx); @@ -117,9 +117,9 @@ get_array_dispatch(struct nouveau_array_state *a, dispatch_t *dispatch) *dispatch = f; } else if (a->type == GL_UNSIGNED_INT) { - auto void f(GLcontext *, unsigned int, int, unsigned int); + auto void f(struct gl_context *, unsigned int, int, unsigned int); - void f(GLcontext *ctx, unsigned int start, int delta, + void f(struct gl_context *ctx, unsigned int start, int delta, unsigned int n) { struct nouveau_channel *chan = context_chan(ctx); RENDER_LOCALS(ctx); @@ -130,9 +130,9 @@ get_array_dispatch(struct nouveau_array_state *a, dispatch_t *dispatch) *dispatch = f; } else { - auto void f(GLcontext *, unsigned int, int, unsigned int); + auto void f(struct gl_context *, unsigned int, int, unsigned int); - void f(GLcontext *ctx, unsigned int start, int delta, + void f(struct gl_context *ctx, unsigned int start, int delta, unsigned int n) { struct nouveau_channel *chan = context_chan(ctx); RENDER_LOCALS(ctx); @@ -208,7 +208,7 @@ get_array_extract(struct nouveau_array_state *a, * always be located right at the beginning of <bo>. */ static inline void * -get_scratch_vbo(GLcontext *ctx, unsigned size, struct nouveau_bo **bo, +get_scratch_vbo(struct gl_context *ctx, unsigned size, struct nouveau_bo **bo, unsigned *offset) { struct nouveau_scratch_state *scratch = &to_render_state(ctx)->scratch; @@ -253,7 +253,7 @@ get_scratch_vbo(GLcontext *ctx, unsigned size, struct nouveau_bo **bo, * Returns how many vertices you can draw using <n> pushbuf dwords. */ static inline unsigned -get_max_vertices(GLcontext *ctx, const struct _mesa_index_buffer *ib, +get_max_vertices(struct gl_context *ctx, const struct _mesa_index_buffer *ib, int n) { struct nouveau_render_state *render = to_render_state(ctx); @@ -290,7 +290,7 @@ get_max_vertices(GLcontext *ctx, const struct _mesa_index_buffer *ib, #include "nouveau_swtnl_t.c" static void -TAG(emit_material)(GLcontext *ctx, struct nouveau_array_state *a, +TAG(emit_material)(struct gl_context *ctx, struct nouveau_array_state *a, const void *v) { const int attr = a->attr - VERT_ATTRIB_GENERIC0; @@ -314,7 +314,7 @@ TAG(emit_material)(GLcontext *ctx, struct nouveau_array_state *a, } static void -TAG(render_prims)(GLcontext *ctx, const struct gl_client_array **arrays, +TAG(render_prims)(struct gl_context *ctx, const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, GLboolean index_bounds_valid, @@ -334,7 +334,7 @@ TAG(render_prims)(GLcontext *ctx, const struct gl_client_array **arrays, } void -TAG(render_init)(GLcontext *ctx) +TAG(render_init)(struct gl_context *ctx) { struct nouveau_render_state *render = to_render_state(ctx); struct nouveau_scratch_state *scratch = &render->scratch; @@ -355,7 +355,7 @@ TAG(render_init)(GLcontext *ctx) } void -TAG(render_destroy)(GLcontext *ctx) +TAG(render_destroy)(struct gl_context *ctx) { TAG(swtnl_destroy)(ctx); } diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c index 4330c8d947..a6e2186cf4 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c @@ -153,7 +153,7 @@ nouveau_destroy_screen(__DRIscreen *dri_screen) static GLboolean nouveau_create_buffer(__DRIscreen *dri_screen, __DRIdrawable *drawable, - const __GLcontextModes *visual, + const struct gl_config *visual, GLboolean is_pixmap) { struct gl_renderbuffer *rb; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_span.c b/src/mesa/drivers/dri/nouveau/nouveau_span.c index 1bfdecc6a2..761cc769ef 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_span.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_span.c @@ -131,7 +131,7 @@ renderbuffer_map_unmap(struct gl_renderbuffer *rb, GLboolean map) } static void -texture_unit_map_unmap(GLcontext *ctx, struct gl_texture_unit *u, GLboolean map) +texture_unit_map_unmap(struct gl_context *ctx, struct gl_texture_unit *u, GLboolean map) { if (!u->_ReallyEnabled) return; @@ -157,7 +157,7 @@ framebuffer_map_unmap(struct gl_framebuffer *fb, GLboolean map) } static void -span_map_unmap(GLcontext *ctx, GLboolean map) +span_map_unmap(struct gl_context *ctx, GLboolean map) { int i; @@ -171,21 +171,21 @@ span_map_unmap(GLcontext *ctx, GLboolean map) } static void -nouveau_span_start(GLcontext *ctx) +nouveau_span_start(struct gl_context *ctx) { nouveau_fallback(ctx, SWRAST); span_map_unmap(ctx, GL_TRUE); } static void -nouveau_span_finish(GLcontext *ctx) +nouveau_span_finish(struct gl_context *ctx) { span_map_unmap(ctx, GL_FALSE); nouveau_fallback(ctx, HWTNL); } void -nouveau_span_functions_init(GLcontext *ctx) +nouveau_span_functions_init(struct gl_context *ctx) { struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c b/src/mesa/drivers/dri/nouveau/nouveau_state.c index 01bcbc4b3c..7b7ddd2f54 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_state.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c @@ -33,45 +33,45 @@ #include "tnl/tnl.h" static void -nouveau_alpha_func(GLcontext *ctx, GLenum func, GLfloat ref) +nouveau_alpha_func(struct gl_context *ctx, GLenum func, GLfloat ref) { context_dirty(ctx, ALPHA_FUNC); } static void -nouveau_blend_color(GLcontext *ctx, const GLfloat color[4]) +nouveau_blend_color(struct gl_context *ctx, const GLfloat color[4]) { context_dirty(ctx, BLEND_COLOR); } static void -nouveau_blend_equation_separate(GLcontext *ctx, GLenum modeRGB, GLenum modeA) +nouveau_blend_equation_separate(struct gl_context *ctx, GLenum modeRGB, GLenum modeA) { context_dirty(ctx, BLEND_EQUATION); } static void -nouveau_blend_func_separate(GLcontext *ctx, GLenum sfactorRGB, +nouveau_blend_func_separate(struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA) { context_dirty(ctx, BLEND_FUNC); } static void -nouveau_clip_plane(GLcontext *ctx, GLenum plane, const GLfloat *equation) +nouveau_clip_plane(struct gl_context *ctx, GLenum plane, const GLfloat *equation) { context_dirty_i(ctx, CLIP_PLANE, plane - GL_CLIP_PLANE0); } static void -nouveau_color_mask(GLcontext *ctx, GLboolean rmask, GLboolean gmask, +nouveau_color_mask(struct gl_context *ctx, GLboolean rmask, GLboolean gmask, GLboolean bmask, GLboolean amask) { context_dirty(ctx, COLOR_MASK); } static void -nouveau_color_material(GLcontext *ctx, GLenum face, GLenum mode) +nouveau_color_material(struct gl_context *ctx, GLenum face, GLenum mode) { context_dirty(ctx, COLOR_MATERIAL); context_dirty(ctx, MATERIAL_FRONT_AMBIENT); @@ -83,44 +83,44 @@ nouveau_color_material(GLcontext *ctx, GLenum face, GLenum mode) } static void -nouveau_cull_face(GLcontext *ctx, GLenum mode) +nouveau_cull_face(struct gl_context *ctx, GLenum mode) { context_dirty(ctx, CULL_FACE); } static void -nouveau_front_face(GLcontext *ctx, GLenum mode) +nouveau_front_face(struct gl_context *ctx, GLenum mode) { context_dirty(ctx, FRONT_FACE); } static void -nouveau_depth_func(GLcontext *ctx, GLenum func) +nouveau_depth_func(struct gl_context *ctx, GLenum func) { context_dirty(ctx, DEPTH); } static void -nouveau_depth_mask(GLcontext *ctx, GLboolean flag) +nouveau_depth_mask(struct gl_context *ctx, GLboolean flag) { context_dirty(ctx, DEPTH); } static void -nouveau_depth_range(GLcontext *ctx, GLclampd nearval, GLclampd farval) +nouveau_depth_range(struct gl_context *ctx, GLclampd nearval, GLclampd farval) { context_dirty(ctx, VIEWPORT); } static void -nouveau_draw_buffers(GLcontext *ctx, GLsizei n, const GLenum *buffers) +nouveau_draw_buffers(struct gl_context *ctx, GLsizei n, const GLenum *buffers) { nouveau_validate_framebuffer(ctx); context_dirty(ctx, FRAMEBUFFER); } static void -nouveau_enable(GLcontext *ctx, GLenum cap, GLboolean state) +nouveau_enable(struct gl_context *ctx, GLenum cap, GLboolean state) { int i; @@ -242,13 +242,13 @@ nouveau_enable(GLcontext *ctx, GLenum cap, GLboolean state) } static void -nouveau_fog(GLcontext *ctx, GLenum pname, const GLfloat *params) +nouveau_fog(struct gl_context *ctx, GLenum pname, const GLfloat *params) { context_dirty(ctx, FOG); } static void -nouveau_light(GLcontext *ctx, GLenum light, GLenum pname, const GLfloat *params) +nouveau_light(struct gl_context *ctx, GLenum light, GLenum pname, const GLfloat *params) { switch (pname) { case GL_AMBIENT: @@ -276,100 +276,100 @@ nouveau_light(GLcontext *ctx, GLenum light, GLenum pname, const GLfloat *params) } static void -nouveau_light_model(GLcontext *ctx, GLenum pname, const GLfloat *params) +nouveau_light_model(struct gl_context *ctx, GLenum pname, const GLfloat *params) { context_dirty(ctx, LIGHT_MODEL); context_dirty(ctx, MODELVIEW); } static void -nouveau_line_stipple(GLcontext *ctx, GLint factor, GLushort pattern ) +nouveau_line_stipple(struct gl_context *ctx, GLint factor, GLushort pattern ) { context_dirty(ctx, LINE_STIPPLE); } static void -nouveau_line_width(GLcontext *ctx, GLfloat width) +nouveau_line_width(struct gl_context *ctx, GLfloat width) { context_dirty(ctx, LINE_MODE); } static void -nouveau_logic_opcode(GLcontext *ctx, GLenum opcode) +nouveau_logic_opcode(struct gl_context *ctx, GLenum opcode) { context_dirty(ctx, LOGIC_OPCODE); } static void -nouveau_point_parameter(GLcontext *ctx, GLenum pname, const GLfloat *params) +nouveau_point_parameter(struct gl_context *ctx, GLenum pname, const GLfloat *params) { context_dirty(ctx, POINT_PARAMETER); } static void -nouveau_point_size(GLcontext *ctx, GLfloat size) +nouveau_point_size(struct gl_context *ctx, GLfloat size) { context_dirty(ctx, POINT_MODE); } static void -nouveau_polygon_mode(GLcontext *ctx, GLenum face, GLenum mode) +nouveau_polygon_mode(struct gl_context *ctx, GLenum face, GLenum mode) { context_dirty(ctx, POLYGON_MODE); } static void -nouveau_polygon_offset(GLcontext *ctx, GLfloat factor, GLfloat units) +nouveau_polygon_offset(struct gl_context *ctx, GLfloat factor, GLfloat units) { context_dirty(ctx, POLYGON_OFFSET); } static void -nouveau_polygon_stipple(GLcontext *ctx, const GLubyte *mask) +nouveau_polygon_stipple(struct gl_context *ctx, const GLubyte *mask) { context_dirty(ctx, POLYGON_STIPPLE); } static void -nouveau_render_mode(GLcontext *ctx, GLenum mode) +nouveau_render_mode(struct gl_context *ctx, GLenum mode) { context_dirty(ctx, RENDER_MODE); } static void -nouveau_scissor(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) +nouveau_scissor(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { context_dirty(ctx, SCISSOR); } static void -nouveau_shade_model(GLcontext *ctx, GLenum mode) +nouveau_shade_model(struct gl_context *ctx, GLenum mode) { context_dirty(ctx, SHADE_MODEL); } static void -nouveau_stencil_func_separate(GLcontext *ctx, GLenum face, GLenum func, +nouveau_stencil_func_separate(struct gl_context *ctx, GLenum face, GLenum func, GLint ref, GLuint mask) { context_dirty(ctx, STENCIL_FUNC); } static void -nouveau_stencil_mask_separate(GLcontext *ctx, GLenum face, GLuint mask) +nouveau_stencil_mask_separate(struct gl_context *ctx, GLenum face, GLuint mask) { context_dirty(ctx, STENCIL_MASK); } static void -nouveau_stencil_op_separate(GLcontext *ctx, GLenum face, GLenum fail, +nouveau_stencil_op_separate(struct gl_context *ctx, GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { context_dirty(ctx, STENCIL_OP); } static void -nouveau_tex_gen(GLcontext *ctx, GLenum coord, GLenum pname, +nouveau_tex_gen(struct gl_context *ctx, GLenum coord, GLenum pname, const GLfloat *params) { switch (pname) { @@ -384,7 +384,7 @@ nouveau_tex_gen(GLcontext *ctx, GLenum coord, GLenum pname, } static void -nouveau_tex_env(GLcontext *ctx, GLenum target, GLenum pname, +nouveau_tex_env(struct gl_context *ctx, GLenum target, GLenum pname, const GLfloat *param) { switch (target) { @@ -398,7 +398,7 @@ nouveau_tex_env(GLcontext *ctx, GLenum target, GLenum pname, } static void -nouveau_tex_parameter(GLcontext *ctx, GLenum target, +nouveau_tex_parameter(struct gl_context *ctx, GLenum target, struct gl_texture_object *t, GLenum pname, const GLfloat *params) { @@ -424,18 +424,18 @@ nouveau_tex_parameter(GLcontext *ctx, GLenum target, } static void -nouveau_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) +nouveau_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { context_dirty(ctx, VIEWPORT); } void -nouveau_emit_nothing(GLcontext *ctx, int emit) +nouveau_emit_nothing(struct gl_context *ctx, int emit) { } int -nouveau_next_dirty_state(GLcontext *ctx) +nouveau_next_dirty_state(struct gl_context *ctx) { struct nouveau_context *nctx = to_nouveau_context(ctx); int i = BITSET_FFS(nctx->dirty) - 1; @@ -447,7 +447,7 @@ nouveau_next_dirty_state(GLcontext *ctx) } void -nouveau_state_emit(GLcontext *ctx) +nouveau_state_emit(struct gl_context *ctx) { struct nouveau_context *nctx = to_nouveau_context(ctx); const struct nouveau_driver *drv = context_drv(ctx); @@ -462,7 +462,7 @@ nouveau_state_emit(GLcontext *ctx) } static void -nouveau_update_state(GLcontext *ctx, GLbitfield new_state) +nouveau_update_state(struct gl_context *ctx, GLbitfield new_state) { int i; @@ -496,7 +496,7 @@ nouveau_update_state(GLcontext *ctx, GLbitfield new_state) } void -nouveau_state_init(GLcontext *ctx) +nouveau_state_init(struct gl_context *ctx) { struct nouveau_context *nctx = to_nouveau_context(ctx); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.h b/src/mesa/drivers/dri/nouveau/nouveau_state.h index 38ac9753c8..cc61cf1a52 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_state.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_state.h @@ -105,18 +105,18 @@ enum { MAX_NOUVEAU_STATE = NUM_NOUVEAU_STATE + 16, }; -typedef void (*nouveau_state_func)(GLcontext *ctx, int emit); +typedef void (*nouveau_state_func)(struct gl_context *ctx, int emit); void -nouveau_state_init(GLcontext *ctx); +nouveau_state_init(struct gl_context *ctx); void -nouveau_emit_nothing(GLcontext *ctx, int emit); +nouveau_emit_nothing(struct gl_context *ctx, int emit); int -nouveau_next_dirty_state(GLcontext *ctx); +nouveau_next_dirty_state(struct gl_context *ctx); void -nouveau_state_emit(GLcontext *ctx); +nouveau_state_emit(struct gl_context *ctx); #endif diff --git a/src/mesa/drivers/dri/nouveau/nouveau_surface.c b/src/mesa/drivers/dri/nouveau/nouveau_surface.c index 33393970a0..e6a712095c 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_surface.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_surface.c @@ -29,13 +29,13 @@ #include "nouveau_util.h" void -nouveau_surface_alloc(GLcontext *ctx, struct nouveau_surface *s, +nouveau_surface_alloc(struct gl_context *ctx, struct nouveau_surface *s, enum nouveau_surface_layout layout, unsigned flags, unsigned format, unsigned width, unsigned height) { - unsigned tile_mode, cpp = _mesa_get_format_bytes(format); - int ret; + unsigned tile_mode = 0, tile_flags = 0; + int ret, cpp = _mesa_get_format_bytes(format); nouveau_bo_ref(NULL, &s->bo); @@ -51,13 +51,21 @@ nouveau_surface_alloc(GLcontext *ctx, struct nouveau_surface *s, if (layout == TILED) { s->pitch = align(s->pitch, 256); tile_mode = s->pitch; + + if (cpp == 4) + tile_flags = NOUVEAU_BO_TILE_32BPP; + else if (cpp == 2) + tile_flags = NOUVEAU_BO_TILE_16BPP; + + if (_mesa_get_format_bits(format, GL_DEPTH_BITS)) + tile_flags |= NOUVEAU_BO_TILE_ZETA; + } else { s->pitch = align(s->pitch, 64); - tile_mode = 0; } ret = nouveau_bo_new_tile(context_dev(ctx), flags, 0, s->pitch * height, - tile_mode, 0, &s->bo); + tile_mode, tile_flags, &s->bo); assert(!ret); } diff --git a/src/mesa/drivers/dri/nouveau/nouveau_surface.h b/src/mesa/drivers/dri/nouveau/nouveau_surface.h index ebdc89afb4..8915ee4ca0 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_surface.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_surface.h @@ -46,7 +46,7 @@ struct nouveau_surface { }; void -nouveau_surface_alloc(GLcontext *ctx, struct nouveau_surface *s, +nouveau_surface_alloc(struct gl_context *ctx, struct nouveau_surface *s, enum nouveau_surface_layout layout, unsigned flags, unsigned format, unsigned width, unsigned height); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_swtnl_t.c b/src/mesa/drivers/dri/nouveau/nouveau_swtnl_t.c index a1609a0dd5..b3588e8fd3 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_swtnl_t.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_swtnl_t.c @@ -99,7 +99,7 @@ static struct swtnl_attr_info { }; static void -swtnl_choose_attrs(GLcontext *ctx) +swtnl_choose_attrs(struct gl_context *ctx) { struct nouveau_render_state *render = to_render_state(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -153,7 +153,7 @@ swtnl_choose_attrs(GLcontext *ctx) } static void -swtnl_alloc_vertices(GLcontext *ctx) +swtnl_alloc_vertices(struct gl_context *ctx) { struct nouveau_swtnl_state *swtnl = &to_render_state(ctx)->swtnl; @@ -164,7 +164,7 @@ swtnl_alloc_vertices(GLcontext *ctx) } static void -swtnl_bind_vertices(GLcontext *ctx) +swtnl_bind_vertices(struct gl_context *ctx) { struct nouveau_render_state *render = to_render_state(ctx); struct nouveau_swtnl_state *swtnl = &render->swtnl; @@ -182,7 +182,7 @@ swtnl_bind_vertices(GLcontext *ctx) } static void -swtnl_unbind_vertices(GLcontext *ctx) +swtnl_unbind_vertices(struct gl_context *ctx) { struct nouveau_render_state *render = to_render_state(ctx); int i; @@ -200,7 +200,7 @@ swtnl_unbind_vertices(GLcontext *ctx) } static void -swtnl_flush_vertices(GLcontext *ctx) +swtnl_flush_vertices(struct gl_context *ctx) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_swtnl_state *swtnl = &to_render_state(ctx)->swtnl; @@ -232,25 +232,25 @@ swtnl_flush_vertices(GLcontext *ctx) /* TnL renderer entry points */ static void -swtnl_start(GLcontext *ctx) +swtnl_start(struct gl_context *ctx) { swtnl_choose_attrs(ctx); } static void -swtnl_finish(GLcontext *ctx) +swtnl_finish(struct gl_context *ctx) { swtnl_flush_vertices(ctx); swtnl_unbind_vertices(ctx); } static void -swtnl_primitive(GLcontext *ctx, GLenum mode) +swtnl_primitive(struct gl_context *ctx, GLenum mode) { } static void -swtnl_reset_stipple(GLcontext *ctx) +swtnl_reset_stipple(struct gl_context *ctx) { } @@ -273,7 +273,7 @@ swtnl_reset_stipple(GLcontext *ctx) } while (0) static void -swtnl_points(GLcontext *ctx, GLuint first, GLuint last) +swtnl_points(struct gl_context *ctx, GLuint first, GLuint last) { int i, count; @@ -289,7 +289,7 @@ swtnl_points(GLcontext *ctx, GLuint first, GLuint last) } static void -swtnl_line(GLcontext *ctx, GLuint v1, GLuint v2) +swtnl_line(struct gl_context *ctx, GLuint v1, GLuint v2) { BEGIN_PRIMITIVE(GL_LINES, 2); OUT_VERTEX(v1); @@ -297,7 +297,7 @@ swtnl_line(GLcontext *ctx, GLuint v1, GLuint v2) } static void -swtnl_triangle(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3) +swtnl_triangle(struct gl_context *ctx, GLuint v1, GLuint v2, GLuint v3) { BEGIN_PRIMITIVE(GL_TRIANGLES, 3); OUT_VERTEX(v1); @@ -306,7 +306,7 @@ swtnl_triangle(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3) } static void -swtnl_quad(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4) +swtnl_quad(struct gl_context *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4) { BEGIN_PRIMITIVE(GL_QUADS, 4); OUT_VERTEX(v1); @@ -317,7 +317,7 @@ swtnl_quad(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4) /* TnL initialization. */ static void -TAG(swtnl_init)(GLcontext *ctx) +TAG(swtnl_init)(struct gl_context *ctx) { TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -348,7 +348,7 @@ TAG(swtnl_init)(GLcontext *ctx) } static void -TAG(swtnl_destroy)(GLcontext *ctx) +TAG(swtnl_destroy)(struct gl_context *ctx) { nouveau_bo_ref(NULL, &to_render_state(ctx)->swtnl.vbo); } diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c b/src/mesa/drivers/dri/nouveau/nouveau_texture.c index d86f78b437..cd063702af 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c @@ -41,7 +41,7 @@ #include "drivers/common/meta.h" static struct gl_texture_object * -nouveau_texture_new(GLcontext *ctx, GLuint name, GLenum target) +nouveau_texture_new(struct gl_context *ctx, GLuint name, GLenum target) { struct nouveau_texture *nt = CALLOC_STRUCT(nouveau_texture); @@ -51,7 +51,7 @@ nouveau_texture_new(GLcontext *ctx, GLuint name, GLenum target) } static void -nouveau_texture_free(GLcontext *ctx, struct gl_texture_object *t) +nouveau_texture_free(struct gl_context *ctx, struct gl_texture_object *t) { struct nouveau_texture *nt = to_nouveau_texture(t); int i; @@ -63,7 +63,7 @@ nouveau_texture_free(GLcontext *ctx, struct gl_texture_object *t) } static struct gl_texture_image * -nouveau_teximage_new(GLcontext *ctx) +nouveau_teximage_new(struct gl_context *ctx) { struct nouveau_teximage *nti = CALLOC_STRUCT(nouveau_teximage); @@ -71,7 +71,7 @@ nouveau_teximage_new(GLcontext *ctx) } static void -nouveau_teximage_free(GLcontext *ctx, struct gl_texture_image *ti) +nouveau_teximage_free(struct gl_context *ctx, struct gl_texture_image *ti) { struct nouveau_teximage *nti = to_nouveau_teximage(ti); @@ -79,7 +79,7 @@ nouveau_teximage_free(GLcontext *ctx, struct gl_texture_image *ti) } static void -nouveau_teximage_map(GLcontext *ctx, struct gl_texture_image *ti) +nouveau_teximage_map(struct gl_context *ctx, struct gl_texture_image *ti) { struct nouveau_surface *s = &to_nouveau_teximage(ti)->surface; int ret; @@ -93,7 +93,7 @@ nouveau_teximage_map(GLcontext *ctx, struct gl_texture_image *ti) } static void -nouveau_teximage_unmap(GLcontext *ctx, struct gl_texture_image *ti) +nouveau_teximage_unmap(struct gl_context *ctx, struct gl_texture_image *ti) { struct nouveau_surface *s = &to_nouveau_teximage(ti)->surface; @@ -103,7 +103,7 @@ nouveau_teximage_unmap(GLcontext *ctx, struct gl_texture_image *ti) } static gl_format -nouveau_choose_tex_format(GLcontext *ctx, GLint internalFormat, +nouveau_choose_tex_format(struct gl_context *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType) { switch (internalFormat) { @@ -178,7 +178,7 @@ nouveau_choose_tex_format(GLcontext *ctx, GLint internalFormat, } static GLboolean -teximage_fits(GLcontext *ctx, struct gl_texture_object *t, int level) +teximage_fits(struct gl_texture_object *t, int level) { struct nouveau_surface *s = &to_nouveau_texture(t)->surfaces[level]; struct gl_texture_image *ti = t->Image[0][level]; @@ -186,8 +186,7 @@ teximage_fits(GLcontext *ctx, struct gl_texture_object *t, int level) if (!ti || !to_nouveau_teximage(ti)->surface.bo) return GL_FALSE; - if (context_chipset(ctx) < 0x10 && - level == t->BaseLevel && (s->offset & 0x7f)) + if (level == t->BaseLevel && (s->offset & 0x7f)) return GL_FALSE; return t->Target == GL_TEXTURE_RECTANGLE || @@ -196,13 +195,13 @@ teximage_fits(GLcontext *ctx, struct gl_texture_object *t, int level) } static GLboolean -validate_teximage(GLcontext *ctx, struct gl_texture_object *t, +validate_teximage(struct gl_context *ctx, struct gl_texture_object *t, int level, int x, int y, int z, int width, int height, int depth) { struct gl_texture_image *ti = t->Image[0][level]; - if (teximage_fits(ctx, t, level)) { + if (teximage_fits(t, level)) { struct nouveau_surface *ss = to_nouveau_texture(t)->surfaces; struct nouveau_surface *s = &to_nouveau_teximage(ti)->surface; @@ -232,7 +231,7 @@ get_last_level(struct gl_texture_object *t) } static void -relayout_texture(GLcontext *ctx, struct gl_texture_object *t) +relayout_texture(struct gl_context *ctx, struct gl_texture_object *t) { struct gl_texture_image *base = t->Image[0][t->BaseLevel]; @@ -285,13 +284,13 @@ relayout_texture(GLcontext *ctx, struct gl_texture_object *t) } GLboolean -nouveau_texture_validate(GLcontext *ctx, struct gl_texture_object *t) +nouveau_texture_validate(struct gl_context *ctx, struct gl_texture_object *t) { struct nouveau_texture *nt = to_nouveau_texture(t); int i, last = get_last_level(t); - if (!teximage_fits(ctx, t, t->BaseLevel) || - !teximage_fits(ctx, t, last)) + if (!teximage_fits(t, t->BaseLevel) || + !teximage_fits(t, last)) return GL_FALSE; if (nt->dirty) { @@ -312,10 +311,10 @@ nouveau_texture_validate(GLcontext *ctx, struct gl_texture_object *t) } void -nouveau_texture_reallocate(GLcontext *ctx, struct gl_texture_object *t) +nouveau_texture_reallocate(struct gl_context *ctx, struct gl_texture_object *t) { - if (!teximage_fits(ctx, t, t->BaseLevel) || - !teximage_fits(ctx, t, get_last_level(t))) { + if (!teximage_fits(t, t->BaseLevel) || + !teximage_fits(t, get_last_level(t))) { texture_dirty(t); relayout_texture(ctx, t); nouveau_texture_validate(ctx, t); @@ -336,7 +335,7 @@ get_teximage_placement(struct gl_texture_image *ti) } static void -nouveau_teximage(GLcontext *ctx, GLint dims, GLenum target, GLint level, +nouveau_teximage(struct gl_context *ctx, GLint dims, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -377,7 +376,7 @@ nouveau_teximage(GLcontext *ctx, GLint dims, GLenum target, GLint level, } if (level == t->BaseLevel) { - if (!teximage_fits(ctx, t, level)) + if (!teximage_fits(t, level)) relayout_texture(ctx, t); nouveau_texture_validate(ctx, t); } @@ -387,7 +386,7 @@ nouveau_teximage(GLcontext *ctx, GLint dims, GLenum target, GLint level, } static void -nouveau_teximage_1d(GLcontext *ctx, GLenum target, GLint level, +nouveau_teximage_1d(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -401,7 +400,7 @@ nouveau_teximage_1d(GLcontext *ctx, GLenum target, GLint level, } static void -nouveau_teximage_2d(GLcontext *ctx, GLenum target, GLint level, +nouveau_teximage_2d(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -415,7 +414,7 @@ nouveau_teximage_2d(GLcontext *ctx, GLenum target, GLint level, } static void -nouveau_teximage_3d(GLcontext *ctx, GLenum target, GLint level, +nouveau_teximage_3d(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -429,7 +428,7 @@ nouveau_teximage_3d(GLcontext *ctx, GLenum target, GLint level, } static void -nouveau_texsubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, +nouveau_texsubimage(struct gl_context *ctx, GLint dims, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint width, GLint height, GLint depth, GLenum format, GLenum type, const void *pixels, @@ -463,7 +462,7 @@ nouveau_texsubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, } static void -nouveau_texsubimage_3d(GLcontext *ctx, GLenum target, GLint level, +nouveau_texsubimage_3d(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint width, GLint height, GLint depth, GLenum format, GLenum type, const void *pixels, @@ -477,7 +476,7 @@ nouveau_texsubimage_3d(GLcontext *ctx, GLenum target, GLint level, } static void -nouveau_texsubimage_2d(GLcontext *ctx, GLenum target, GLint level, +nouveau_texsubimage_2d(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint width, GLint height, GLenum format, GLenum type, const void *pixels, @@ -491,7 +490,7 @@ nouveau_texsubimage_2d(GLcontext *ctx, GLenum target, GLint level, } static void -nouveau_texsubimage_1d(GLcontext *ctx, GLenum target, GLint level, +nouveau_texsubimage_1d(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint width, GLenum format, GLenum type, const void *pixels, const struct gl_pixelstore_attrib *packing, @@ -504,7 +503,7 @@ nouveau_texsubimage_1d(GLcontext *ctx, GLenum target, GLint level, } static void -nouveau_get_teximage(GLcontext *ctx, GLenum target, GLint level, +nouveau_get_teximage(struct gl_context *ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels, struct gl_texture_object *t, struct gl_texture_image *ti) @@ -516,7 +515,7 @@ nouveau_get_teximage(GLcontext *ctx, GLenum target, GLint level, } static void -nouveau_bind_texture(GLcontext *ctx, GLenum target, +nouveau_bind_texture(struct gl_context *ctx, GLenum target, struct gl_texture_object *t) { context_dirty_i(ctx, TEX_OBJ, ctx->Texture.CurrentUnit); @@ -542,7 +541,7 @@ nouveau_set_texbuffer(__DRIcontext *dri_ctx, __DRIdrawable *draw) { struct nouveau_context *nctx = dri_ctx->driverPrivate; - GLcontext *ctx = &nctx->base; + struct gl_context *ctx = &nctx->base; struct gl_framebuffer *fb = draw->driverPrivate; struct gl_renderbuffer *rb = fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer; @@ -575,7 +574,7 @@ nouveau_set_texbuffer(__DRIcontext *dri_ctx, } static void -nouveau_texture_map(GLcontext *ctx, struct gl_texture_object *t) +nouveau_texture_map(struct gl_context *ctx, struct gl_texture_object *t) { int i; @@ -586,7 +585,7 @@ nouveau_texture_map(GLcontext *ctx, struct gl_texture_object *t) } static void -nouveau_texture_unmap(GLcontext *ctx, struct gl_texture_object *t) +nouveau_texture_unmap(struct gl_context *ctx, struct gl_texture_object *t) { int i; @@ -597,14 +596,14 @@ nouveau_texture_unmap(GLcontext *ctx, struct gl_texture_object *t) } static void -store_mipmap(GLcontext *ctx, GLenum target, int first, int last, +store_mipmap(struct gl_context *ctx, GLenum target, int first, int last, struct gl_texture_object *t) { struct gl_pixelstore_attrib packing = { .BufferObj = ctx->Shared->NullBufferObj, .Alignment = 1 }; - GLenum format = t->Image[0][first]->TexFormat; + GLenum format = t->Image[0][t->BaseLevel]->TexFormat; unsigned base_format, type, comps; int i; @@ -625,7 +624,7 @@ store_mipmap(GLcontext *ctx, GLenum target, int first, int last, } static void -nouveau_generate_mipmap(GLcontext *ctx, GLenum target, +nouveau_generate_mipmap(struct gl_context *ctx, GLenum target, struct gl_texture_object *t) { if (_mesa_meta_check_generate_mipmap_fallback(ctx, target, t)) { diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.h b/src/mesa/drivers/dri/nouveau/nouveau_texture.h index 251f537bba..fc170215f3 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_texture.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.h @@ -49,9 +49,9 @@ nouveau_set_texbuffer(__DRIcontext *dri_ctx, __DRIdrawable *draw); GLboolean -nouveau_texture_validate(GLcontext *ctx, struct gl_texture_object *t); +nouveau_texture_validate(struct gl_context *ctx, struct gl_texture_object *t); void -nouveau_texture_reallocate(GLcontext *ctx, struct gl_texture_object *t); +nouveau_texture_reallocate(struct gl_context *ctx, struct gl_texture_object *t); #endif diff --git a/src/mesa/drivers/dri/nouveau/nouveau_util.h b/src/mesa/drivers/dri/nouveau/nouveau_util.h index 584cb80ef6..8df8867d14 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_util.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_util.h @@ -130,7 +130,7 @@ get_scissors(struct gl_framebuffer *fb, int *x, int *y, int *w, int *h) } static inline void -get_viewport_scale(GLcontext *ctx, float a[16]) +get_viewport_scale(struct gl_context *ctx, float a[16]) { struct gl_viewport_attrib *vp = &ctx->Viewport; struct gl_framebuffer *fb = ctx->DrawBuffer; @@ -147,7 +147,7 @@ get_viewport_scale(GLcontext *ctx, float a[16]) } static inline void -get_viewport_translate(GLcontext *ctx, float a[4]) +get_viewport_translate(struct gl_context *ctx, float a[4]) { struct gl_viewport_attrib *vp = &ctx->Viewport; struct gl_framebuffer *fb = ctx->DrawBuffer; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c index e5858f8268..394f3c9b50 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c @@ -32,7 +32,7 @@ /* Arbitrary pushbuf length we can assume we can get with a single * WAIT_RING. */ -#define PUSHBUF_DWORDS 2048 +#define PUSHBUF_DWORDS 65536 /* Functions to set up struct nouveau_array_state from something like * a GL array or index buffer. */ @@ -86,7 +86,7 @@ vbo_deinit_array(struct nouveau_array_state *a) } static int -get_array_stride(GLcontext *ctx, const struct gl_client_array *a) +get_array_stride(struct gl_context *ctx, const struct gl_client_array *a) { struct nouveau_render_state *render = to_render_state(ctx); @@ -98,7 +98,7 @@ get_array_stride(GLcontext *ctx, const struct gl_client_array *a) } static void -vbo_init_arrays(GLcontext *ctx, const struct _mesa_index_buffer *ib, +vbo_init_arrays(struct gl_context *ctx, const struct _mesa_index_buffer *ib, const struct gl_client_array **arrays) { struct nouveau_render_state *render = to_render_state(ctx); @@ -124,7 +124,7 @@ vbo_init_arrays(GLcontext *ctx, const struct _mesa_index_buffer *ib, } static void -vbo_deinit_arrays(GLcontext *ctx, const struct _mesa_index_buffer *ib, +vbo_deinit_arrays(struct gl_context *ctx, const struct _mesa_index_buffer *ib, const struct gl_client_array **arrays) { struct nouveau_render_state *render = to_render_state(ctx); @@ -143,12 +143,13 @@ vbo_deinit_arrays(GLcontext *ctx, const struct _mesa_index_buffer *ib, } render->attr_count = 0; + context_bctx(ctx, VERTEX); } /* Make some rendering decisions from the GL context. */ static void -vbo_choose_render_mode(GLcontext *ctx, const struct gl_client_array **arrays) +vbo_choose_render_mode(struct gl_context *ctx, const struct gl_client_array **arrays) { struct nouveau_render_state *render = to_render_state(ctx); int i; @@ -171,7 +172,7 @@ vbo_choose_render_mode(GLcontext *ctx, const struct gl_client_array **arrays) } static void -vbo_emit_attr(GLcontext *ctx, const struct gl_client_array **arrays, int attr) +vbo_emit_attr(struct gl_context *ctx, const struct gl_client_array **arrays, int attr) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_render_state *render = to_render_state(ctx); @@ -208,7 +209,7 @@ vbo_emit_attr(GLcontext *ctx, const struct gl_client_array **arrays, int attr) #define MAT(a) (VERT_ATTRIB_GENERIC0 + MAT_ATTRIB_##a) static void -vbo_choose_attrs(GLcontext *ctx, const struct gl_client_array **arrays) +vbo_choose_attrs(struct gl_context *ctx, const struct gl_client_array **arrays) { struct nouveau_render_state *render = to_render_state(ctx); int i; @@ -250,7 +251,7 @@ vbo_choose_attrs(GLcontext *ctx, const struct gl_client_array **arrays) } static int -get_max_client_stride(GLcontext *ctx, const struct gl_client_array **arrays) +get_max_client_stride(struct gl_context *ctx, const struct gl_client_array **arrays) { struct nouveau_render_state *render = to_render_state(ctx); int i, s = 0; @@ -270,14 +271,14 @@ get_max_client_stride(GLcontext *ctx, const struct gl_client_array **arrays) } static void -TAG(vbo_render_prims)(GLcontext *ctx, const struct gl_client_array **arrays, +TAG(vbo_render_prims)(struct gl_context *ctx, const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, GLboolean index_bounds_valid, GLuint min_index, GLuint max_index); static GLboolean -vbo_maybe_split(GLcontext *ctx, const struct gl_client_array **arrays, +vbo_maybe_split(struct gl_context *ctx, const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, GLuint min_index, GLuint max_index) @@ -315,7 +316,7 @@ vbo_maybe_split(GLcontext *ctx, const struct gl_client_array **arrays, /* VBO rendering path. */ static void -vbo_bind_vertices(GLcontext *ctx, const struct gl_client_array **arrays, +vbo_bind_vertices(struct gl_context *ctx, const struct gl_client_array **arrays, GLint basevertex, GLuint min_index, GLuint max_index) { struct nouveau_render_state *render = to_render_state(ctx); @@ -353,7 +354,7 @@ vbo_bind_vertices(GLcontext *ctx, const struct gl_client_array **arrays, } static void -vbo_draw_vbo(GLcontext *ctx, const struct gl_client_array **arrays, +vbo_draw_vbo(struct gl_context *ctx, const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, GLuint min_index, GLuint max_index) @@ -395,7 +396,7 @@ extract_id(struct nouveau_array_state *a, int i, int j) } static void -vbo_draw_imm(GLcontext *ctx, const struct gl_client_array **arrays, +vbo_draw_imm(struct gl_context *ctx, const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, GLuint min_index, GLuint max_index) @@ -432,7 +433,7 @@ vbo_draw_imm(GLcontext *ctx, const struct gl_client_array **arrays, /* draw_prims entry point when we're doing hw-tnl. */ static void -TAG(vbo_render_prims)(GLcontext *ctx, const struct gl_client_array **arrays, +TAG(vbo_render_prims)(struct gl_context *ctx, const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, GLboolean index_bounds_valid, diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c b/src/mesa/drivers/dri/nouveau/nv04_context.c index 94422f559d..8683343b39 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_context.c +++ b/src/mesa/drivers/dri/nouveau/nv04_context.c @@ -46,7 +46,7 @@ texunit_needs_combiners(struct gl_texture_unit *u) } struct nouveau_grobj * -nv04_context_engine(GLcontext *ctx) +nv04_context_engine(struct gl_context *ctx) { struct nv04_context *nctx = to_nv04_context(ctx); struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw; @@ -90,7 +90,7 @@ static void nv04_channel_flush_notify(struct nouveau_channel *chan) { struct nouveau_context *nctx = chan->user_private; - GLcontext *ctx = &nctx->base; + struct gl_context *ctx = &nctx->base; if (nctx->fallback < SWRAST) { nouveau_bo_state_emit(ctx); @@ -106,7 +106,7 @@ nv04_channel_flush_notify(struct nouveau_channel *chan) } static void -nv04_hwctx_init(GLcontext *ctx) +nv04_hwctx_init(struct gl_context *ctx) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw; @@ -136,7 +136,7 @@ nv04_hwctx_init(GLcontext *ctx) } static void -init_dummy_texture(GLcontext *ctx) +init_dummy_texture(struct gl_context *ctx) { struct nouveau_surface *s = &to_nv04_context(ctx)->dummy_texture; @@ -150,7 +150,7 @@ init_dummy_texture(GLcontext *ctx) } static void -nv04_context_destroy(GLcontext *ctx) +nv04_context_destroy(struct gl_context *ctx) { struct nouveau_context *nctx = to_nouveau_context(ctx); @@ -166,13 +166,13 @@ nv04_context_destroy(GLcontext *ctx) FREE(ctx); } -static GLcontext * -nv04_context_create(struct nouveau_screen *screen, const GLvisual *visual, - GLcontext *share_ctx) +static struct gl_context * +nv04_context_create(struct nouveau_screen *screen, const struct gl_config *visual, + struct gl_context *share_ctx) { struct nv04_context *nctx; struct nouveau_hw_state *hw; - GLcontext *ctx; + struct gl_context *ctx; int ret; nctx = CALLOC_STRUCT(nv04_context); diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.h b/src/mesa/drivers/dri/nouveau/nv04_context.h index ccd3b61e26..45e70d2bc3 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_context.h +++ b/src/mesa/drivers/dri/nouveau/nv04_context.h @@ -40,7 +40,7 @@ struct nv04_context { #define nv04_mtex_engine(obj) ((obj)->grclass == NV04_MULTITEX_TRIANGLE) struct nouveau_grobj * -nv04_context_engine(GLcontext *ctx); +nv04_context_engine(struct gl_context *ctx); extern const struct nouveau_driver nv04_driver; diff --git a/src/mesa/drivers/dri/nouveau/nv04_driver.h b/src/mesa/drivers/dri/nouveau/nv04_driver.h index 4d599e683a..554914d1c3 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_driver.h +++ b/src/mesa/drivers/dri/nouveau/nv04_driver.h @@ -39,55 +39,55 @@ enum { /* nv04_render.c */ void -nv04_render_init(GLcontext *ctx); +nv04_render_init(struct gl_context *ctx); void -nv04_render_destroy(GLcontext *ctx); +nv04_render_destroy(struct gl_context *ctx); /* nv04_surface.c */ GLboolean -nv04_surface_init(GLcontext *ctx); +nv04_surface_init(struct gl_context *ctx); void -nv04_surface_takedown(GLcontext *ctx); +nv04_surface_takedown(struct gl_context *ctx); void -nv04_surface_copy(GLcontext *ctx, +nv04_surface_copy(struct gl_context *ctx, struct nouveau_surface *dst, struct nouveau_surface *src, int dx, int dy, int sx, int sy, int w, int h); void -nv04_surface_fill(GLcontext *ctx, +nv04_surface_fill(struct gl_context *ctx, struct nouveau_surface *dst, unsigned mask, unsigned value, int dx, int dy, int w, int h); /* nv04_state_fb.c */ void -nv04_emit_framebuffer(GLcontext *ctx, int emit); +nv04_emit_framebuffer(struct gl_context *ctx, int emit); void -nv04_emit_scissor(GLcontext *ctx, int emit); +nv04_emit_scissor(struct gl_context *ctx, int emit); /* nv04_state_raster.c */ void -nv04_defer_control(GLcontext *ctx, int emit); +nv04_defer_control(struct gl_context *ctx, int emit); void -nv04_emit_control(GLcontext *ctx, int emit); +nv04_emit_control(struct gl_context *ctx, int emit); void -nv04_defer_blend(GLcontext *ctx, int emit); +nv04_defer_blend(struct gl_context *ctx, int emit); void -nv04_emit_blend(GLcontext *ctx, int emit); +nv04_emit_blend(struct gl_context *ctx, int emit); /* nv04_state_frag.c */ void -nv04_emit_tex_env(GLcontext *ctx, int emit); +nv04_emit_tex_env(struct gl_context *ctx, int emit); /* nv04_state_tex.c */ void -nv04_emit_tex_obj(GLcontext *ctx, int emit); +nv04_emit_tex_obj(struct gl_context *ctx, int emit); #endif diff --git a/src/mesa/drivers/dri/nouveau/nv04_render.c b/src/mesa/drivers/dri/nouveau/nv04_render.c index 56e396d51f..47bad24f9d 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_render.c +++ b/src/mesa/drivers/dri/nouveau/nv04_render.c @@ -37,7 +37,7 @@ #define NUM_VERTEX_ATTRS 6 static void -swtnl_update_viewport(GLcontext *ctx) +swtnl_update_viewport(struct gl_context *ctx) { float *viewport = to_nv04_context(ctx)->viewport; struct gl_framebuffer *fb = ctx->DrawBuffer; @@ -51,7 +51,7 @@ swtnl_update_viewport(GLcontext *ctx) } static void -swtnl_emit_attr(GLcontext *ctx, struct tnl_attr_map *m, int attr, int emit) +swtnl_emit_attr(struct gl_context *ctx, struct tnl_attr_map *m, int attr, int emit) { TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -68,7 +68,7 @@ swtnl_emit_attr(GLcontext *ctx, struct tnl_attr_map *m, int attr, int emit) } static void -swtnl_choose_attrs(GLcontext *ctx) +swtnl_choose_attrs(struct gl_context *ctx) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct nouveau_grobj *fahrenheit = nv04_context_engine(ctx); @@ -94,24 +94,24 @@ swtnl_choose_attrs(GLcontext *ctx) /* TnL renderer entry points */ static void -swtnl_start(GLcontext *ctx) +swtnl_start(struct gl_context *ctx) { swtnl_choose_attrs(ctx); } static void -swtnl_finish(GLcontext *ctx) +swtnl_finish(struct gl_context *ctx) { FIRE_RING(context_chan(ctx)); } static void -swtnl_primitive(GLcontext *ctx, GLenum mode) +swtnl_primitive(struct gl_context *ctx, GLenum mode) { } static void -swtnl_reset_stipple(GLcontext *ctx) +swtnl_reset_stipple(struct gl_context *ctx) { } @@ -146,17 +146,17 @@ swtnl_reset_stipple(GLcontext *ctx) } static void -swtnl_points(GLcontext *ctx, GLuint first, GLuint last) +swtnl_points(struct gl_context *ctx, GLuint first, GLuint last) { } static void -swtnl_line(GLcontext *ctx, GLuint v1, GLuint v2) +swtnl_line(struct gl_context *ctx, GLuint v1, GLuint v2) { } static void -swtnl_triangle(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3) +swtnl_triangle(struct gl_context *ctx, GLuint v1, GLuint v2, GLuint v3) { BEGIN_PRIMITIVE(3); OUT_VERTEX(v1); @@ -166,7 +166,7 @@ swtnl_triangle(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3) } static void -swtnl_quad(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4) +swtnl_quad(struct gl_context *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4) { BEGIN_PRIMITIVE(4); OUT_VERTEX(v1); @@ -178,7 +178,7 @@ swtnl_quad(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4) /* TnL initialization. */ void -nv04_render_init(GLcontext *ctx) +nv04_render_init(struct gl_context *ctx) { TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -207,6 +207,6 @@ nv04_render_init(GLcontext *ctx) } void -nv04_render_destroy(GLcontext *ctx) +nv04_render_destroy(struct gl_context *ctx) { } diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_fb.c b/src/mesa/drivers/dri/nouveau/nv04_state_fb.c index b9d232dbb8..a3e343660f 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_state_fb.c +++ b/src/mesa/drivers/dri/nouveau/nv04_state_fb.c @@ -47,7 +47,7 @@ get_rt_format(gl_format format) } void -nv04_emit_framebuffer(GLcontext *ctx, int emit) +nv04_emit_framebuffer(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw; @@ -97,7 +97,7 @@ nv04_emit_framebuffer(GLcontext *ctx, int emit) } void -nv04_emit_scissor(GLcontext *ctx, int emit) +nv04_emit_scissor(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw; diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_frag.c b/src/mesa/drivers/dri/nouveau/nv04_state_frag.c index bb5d7dc20f..658b23a4d9 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_state_frag.c +++ b/src/mesa/drivers/dri/nouveau/nv04_state_frag.c @@ -41,7 +41,7 @@ NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ALPHA0 struct combiner_state { - GLcontext *ctx; + struct gl_context *ctx; int unit; GLboolean alpha; GLboolean premodulate; @@ -234,7 +234,7 @@ setup_combiner(struct combiner_state *rc) } void -nv04_emit_tex_env(GLcontext *ctx, int emit) +nv04_emit_tex_env(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_TEX_ENV0; struct nouveau_channel *chan = context_chan(ctx); diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c index c191571a5f..a114f44b22 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c +++ b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c @@ -127,13 +127,13 @@ get_blend_func(unsigned func) } void -nv04_defer_control(GLcontext *ctx, int emit) +nv04_defer_control(struct gl_context *ctx, int emit) { context_dirty(ctx, CONTROL); } void -nv04_emit_control(GLcontext *ctx, int emit) +nv04_emit_control(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *fahrenheit = nv04_context_engine(ctx); @@ -247,13 +247,13 @@ nv04_emit_control(GLcontext *ctx, int emit) } void -nv04_defer_blend(GLcontext *ctx, int emit) +nv04_defer_blend(struct gl_context *ctx, int emit) { context_dirty(ctx, BLEND); } void -nv04_emit_blend(GLcontext *ctx, int emit) +nv04_emit_blend(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *fahrenheit = nv04_context_engine(ctx); diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c index 4ac8327b87..1fe47a30e4 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c +++ b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c @@ -55,26 +55,8 @@ get_tex_format(struct gl_texture_image *ti) } } -static inline unsigned -get_wrap_mode(unsigned wrap) -{ - switch (wrap) { - case GL_REPEAT: - return 0x1; - case GL_MIRRORED_REPEAT: - return 0x2; - case GL_CLAMP: - case GL_CLAMP_TO_EDGE: - return 0x3; - case GL_CLAMP_TO_BORDER: - return 0x4; - default: - assert(0); - } -} - void -nv04_emit_tex_obj(GLcontext *ctx, int emit) +nv04_emit_tex_obj(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_TEX_OBJ0; struct nouveau_channel *chan = context_chan(ctx); @@ -106,8 +88,8 @@ nv04_emit_tex_obj(GLcontext *ctx, int emit) t->LodBias, -16, 15) * 8; } - format |= get_wrap_mode(t->WrapT) << 28 | - get_wrap_mode(t->WrapS) << 24 | + format |= nvgl_wrap_mode(t->WrapT) << 28 | + nvgl_wrap_mode(t->WrapS) << 24 | ti->HeightLog2 << 20 | ti->WidthLog2 << 16 | lod_max << 12 | diff --git a/src/mesa/drivers/dri/nouveau/nv04_surface.c b/src/mesa/drivers/dri/nouveau/nv04_surface.c index 9e7dcf0a88..6d3ffa26d3 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_surface.c +++ b/src/mesa/drivers/dri/nouveau/nv04_surface.c @@ -191,7 +191,7 @@ sifm_format(gl_format format) } static void -nv04_surface_copy_swizzle(GLcontext *ctx, +nv04_surface_copy_swizzle(struct gl_context *ctx, struct nouveau_surface *dst, struct nouveau_surface *src, int dx, int dy, int sx, int sy, @@ -214,11 +214,6 @@ nv04_surface_copy_swizzle(GLcontext *ctx, assert(_mesa_is_pow_two(dst->width) && _mesa_is_pow_two(dst->height)); - /* If area is too large to copy in one shot we must copy it in - * POT chunks to meet alignment requirements */ - assert(sub_w == w || _mesa_is_pow_two(w)); - assert(sub_h == h || _mesa_is_pow_two(h)); - nouveau_bo_marko(bctx, sifm, NV03_SCALED_IMAGE_FROM_MEMORY_DMA_IMAGE, src->bo, bo_flags | NOUVEAU_BO_RD); nouveau_bo_marko(bctx, swzsurf, NV04_SWIZZLED_SURFACE_DMA_IMAGE, @@ -274,7 +269,7 @@ nv04_surface_copy_swizzle(GLcontext *ctx, } static void -nv04_surface_copy_m2mf(GLcontext *ctx, +nv04_surface_copy_m2mf(struct gl_context *ctx, struct nouveau_surface *dst, struct nouveau_surface *src, int dx, int dy, int sx, int sy, @@ -367,7 +362,7 @@ get_swizzled_offset(struct nouveau_surface *s, unsigned x, unsigned y) } static void -nv04_surface_copy_cpu(GLcontext *ctx, +nv04_surface_copy_cpu(struct gl_context *ctx, struct nouveau_surface *dst, struct nouveau_surface *src, int dx, int dy, int sx, int sy, @@ -398,7 +393,7 @@ nv04_surface_copy_cpu(GLcontext *ctx, } void -nv04_surface_copy(GLcontext *ctx, +nv04_surface_copy(struct gl_context *ctx, struct nouveau_surface *dst, struct nouveau_surface *src, int dx, int dy, int sx, int sy, @@ -423,7 +418,7 @@ nv04_surface_copy(GLcontext *ctx, } void -nv04_surface_fill(GLcontext *ctx, +nv04_surface_fill(struct gl_context *ctx, struct nouveau_surface *dst, unsigned mask, unsigned value, int dx, int dy, int w, int h) @@ -465,7 +460,7 @@ nv04_surface_fill(GLcontext *ctx, } void -nv04_surface_takedown(GLcontext *ctx) +nv04_surface_takedown(struct gl_context *ctx) { struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw; @@ -480,7 +475,7 @@ nv04_surface_takedown(GLcontext *ctx) } GLboolean -nv04_surface_init(GLcontext *ctx) +nv04_surface_init(struct gl_context *ctx) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw; diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c b/src/mesa/drivers/dri/nouveau/nv10_context.c index 08be2a25a0..fdcb43b771 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_context.c +++ b/src/mesa/drivers/dri/nouveau/nv10_context.c @@ -40,33 +40,157 @@ static const struct dri_extension nv10_extensions[] = { { NULL, NULL } }; +static GLboolean +use_fast_zclear(struct gl_context *ctx, GLbitfield buffers) +{ + struct nouveau_context *nctx = to_nouveau_context(ctx); + struct gl_framebuffer *fb = ctx->DrawBuffer; + + if (buffers & BUFFER_BIT_STENCIL) { + /* + * The stencil test is bypassed when fast Z clears are + * enabled. + */ + nctx->hierz.clear_blocked = GL_TRUE; + context_dirty(ctx, ZCLEAR); + return GL_FALSE; + } + + return !nctx->hierz.clear_blocked && + fb->_Xmax == fb->Width && fb->_Xmin == 0 && + fb->_Ymax == fb->Height && fb->_Ymin == 0; +} + +GLboolean +nv10_use_viewport_zclear(struct gl_context *ctx) +{ + struct nouveau_context *nctx = to_nouveau_context(ctx); + struct gl_framebuffer *fb = ctx->DrawBuffer; + + return context_chipset(ctx) < 0x17 && + !nctx->hierz.clear_blocked && fb->_DepthBuffer && + (_mesa_get_format_bits(fb->_DepthBuffer->Format, + GL_DEPTH_BITS) >= 24); +} + +float +nv10_transform_depth(struct gl_context *ctx, float z) +{ + struct nouveau_context *nctx = to_nouveau_context(ctx); + + if (nv10_use_viewport_zclear(ctx)) + return 2097152.0 * (z + (nctx->hierz.clear_seq & 7)); + else + return ctx->DrawBuffer->_DepthMaxF * z; +} + static void -nv10_clear(GLcontext *ctx, GLbitfield buffers) +nv10_zclear(struct gl_context *ctx, GLbitfield *buffers) { + /* + * Pre-nv17 cards don't have native support for fast Z clears, + * but in some cases we can still "clear" the Z buffer without + * actually blitting to it if we're willing to sacrifice a few + * bits of depth precision. + * + * Each time a clear is requested we modify the viewport + * transform in such a way that the old contents of the depth + * buffer are clamped to the requested clear value when + * they're read by the GPU. + */ + struct nouveau_context *nctx = to_nouveau_context(ctx); + struct gl_framebuffer *fb = ctx->DrawBuffer; + struct nouveau_framebuffer *nfb = to_nouveau_framebuffer(fb); + struct nouveau_surface *s = &to_nouveau_renderbuffer( + fb->_DepthBuffer->Wrapped)->surface; + + if (nv10_use_viewport_zclear(ctx)) { + int x, y, w, h; + float z = ctx->Depth.Clear; + uint32_t value = pack_zs_f(s->format, z, 0); + + get_scissors(fb, &x, &y, &w, &h); + *buffers &= ~BUFFER_BIT_DEPTH; + + if (use_fast_zclear(ctx, *buffers)) { + if (nfb->hierz.clear_value != value) { + /* Don't fast clear if we're changing + * the depth value. */ + nfb->hierz.clear_value = value; + + } else if (z == 0.0) { + nctx->hierz.clear_seq++; + context_dirty(ctx, ZCLEAR); + + if ((nctx->hierz.clear_seq & 7) != 0 && + nctx->hierz.clear_seq != 1) + /* We didn't wrap around -- no need to + * clear the depth buffer for real. */ + return; + + } else if (z == 1.0) { + nctx->hierz.clear_seq--; + context_dirty(ctx, ZCLEAR); + + if ((nctx->hierz.clear_seq & 7) != 7) + /* No wrap around */ + return; + } + } + + value = pack_zs_f(s->format, + (z + (nctx->hierz.clear_seq & 7)) / 8, 0); + context_drv(ctx)->surface_fill(ctx, s, ~0, value, x, y, w, h); + } +} + +static void +nv17_zclear(struct gl_context *ctx, GLbitfield *buffers) +{ + struct nouveau_context *nctx = to_nouveau_context(ctx); struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); struct nouveau_framebuffer *nfb = to_nouveau_framebuffer( ctx->DrawBuffer); + struct nouveau_surface *s = &to_nouveau_renderbuffer( + nfb->base._DepthBuffer->Wrapped)->surface; - nouveau_validate_framebuffer(ctx); + /* Clear the hierarchical depth buffer */ + BEGIN_RING(chan, celsius, NV17TCL_LMA_DEPTH_FILL_VALUE, 1); + OUT_RING(chan, pack_zs_f(s->format, ctx->Depth.Clear, 0)); + BEGIN_RING(chan, celsius, NV17TCL_LMA_DEPTH_BUFFER_CLEAR, 1); + OUT_RING(chan, 1); - /* Clear the LMA depth buffer, if present. */ - if ((buffers & BUFFER_BIT_DEPTH) && ctx->Depth.Mask && - nfb->lma_bo) { - struct nouveau_surface *s = &to_nouveau_renderbuffer( - nfb->base._DepthBuffer->Wrapped)->surface; + /* Mark the depth buffer as cleared */ + if (use_fast_zclear(ctx, *buffers)) { + if (nctx->hierz.clear_seq) + *buffers &= ~BUFFER_BIT_DEPTH; - BEGIN_RING(chan, celsius, NV17TCL_LMA_DEPTH_FILL_VALUE, 1); - OUT_RING(chan, pack_zs_f(s->format, ctx->Depth.Clear, 0)); - BEGIN_RING(chan, celsius, NV17TCL_LMA_DEPTH_BUFFER_CLEAR, 1); - OUT_RING(chan, 1); + nfb->hierz.clear_value = + pack_zs_f(s->format, ctx->Depth.Clear, 0); + nctx->hierz.clear_seq++; + + context_dirty(ctx, ZCLEAR); + } +} + +static void +nv10_clear(struct gl_context *ctx, GLbitfield buffers) +{ + nouveau_validate_framebuffer(ctx); + + if ((buffers & BUFFER_BIT_DEPTH) && ctx->Depth.Mask) { + if (context_chipset(ctx) >= 0x17) + nv17_zclear(ctx, &buffers); + else + nv10_zclear(ctx, &buffers); } nouveau_clear(ctx, buffers); } static void -nv10_hwctx_init(GLcontext *ctx) +nv10_hwctx_init(struct gl_context *ctx) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -271,14 +395,14 @@ nv10_hwctx_init(GLcontext *ctx) OUT_RING(chan, 1); BEGIN_RING(chan, celsius, NV10TCL_DEPTH_RANGE_NEAR, 2); - OUT_RING(chan, 0.0); + OUT_RINGf(chan, 0.0); OUT_RINGf(chan, 16777216.0); FIRE_RING(chan); } static void -nv10_context_destroy(GLcontext *ctx) +nv10_context_destroy(struct gl_context *ctx) { struct nouveau_context *nctx = to_nouveau_context(ctx); @@ -291,12 +415,12 @@ nv10_context_destroy(GLcontext *ctx) FREE(ctx); } -static GLcontext * -nv10_context_create(struct nouveau_screen *screen, const GLvisual *visual, - GLcontext *share_ctx) +static struct gl_context * +nv10_context_create(struct nouveau_screen *screen, const struct gl_config *visual, + struct gl_context *share_ctx) { struct nouveau_context *nctx; - GLcontext *ctx; + struct gl_context *ctx; unsigned celsius_class; int ret; @@ -423,7 +547,8 @@ const struct nouveau_driver nv10_driver = { nv10_emit_tex_obj, nouveau_emit_nothing, nouveau_emit_nothing, - nv10_emit_viewport + nv10_emit_viewport, + nv10_emit_zclear }, - .num_emit = NUM_NOUVEAU_STATE, + .num_emit = NUM_NV10_STATE, }; diff --git a/src/mesa/drivers/dri/nouveau/nv10_driver.h b/src/mesa/drivers/dri/nouveau/nv10_driver.h index cefd6c6fba..dec3d64e7d 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_driver.h +++ b/src/mesa/drivers/dri/nouveau/nv10_driver.h @@ -27,121 +27,135 @@ #ifndef __NV10_DRIVER_H__ #define __NV10_DRIVER_H__ +enum { + NOUVEAU_STATE_ZCLEAR = NUM_NOUVEAU_STATE, + NUM_NV10_STATE +}; + #define NV10_TEXTURE_UNITS 2 /* nv10_context.c */ extern const struct nouveau_driver nv10_driver; +GLboolean +nv10_use_viewport_zclear(struct gl_context *ctx); + +float +nv10_transform_depth(struct gl_context *ctx, float z); + /* nv10_render.c */ void -nv10_render_init(GLcontext *ctx); +nv10_render_init(struct gl_context *ctx); void -nv10_render_destroy(GLcontext *ctx); +nv10_render_destroy(struct gl_context *ctx); /* nv10_state_fb.c */ void -nv10_emit_framebuffer(GLcontext *ctx, int emit); +nv10_emit_framebuffer(struct gl_context *ctx, int emit); + +void +nv10_emit_render_mode(struct gl_context *ctx, int emit); void -nv10_emit_render_mode(GLcontext *ctx, int emit); +nv10_emit_scissor(struct gl_context *ctx, int emit); void -nv10_emit_scissor(GLcontext *ctx, int emit); +nv10_emit_viewport(struct gl_context *ctx, int emit); void -nv10_emit_viewport(GLcontext *ctx, int emit); +nv10_emit_zclear(struct gl_context *ctx, int emit); /* nv10_state_polygon.c */ void -nv10_emit_cull_face(GLcontext *ctx, int emit); +nv10_emit_cull_face(struct gl_context *ctx, int emit); void -nv10_emit_front_face(GLcontext *ctx, int emit); +nv10_emit_front_face(struct gl_context *ctx, int emit); void -nv10_emit_line_mode(GLcontext *ctx, int emit); +nv10_emit_line_mode(struct gl_context *ctx, int emit); void -nv10_emit_line_stipple(GLcontext *ctx, int emit); +nv10_emit_line_stipple(struct gl_context *ctx, int emit); void -nv10_emit_point_mode(GLcontext *ctx, int emit); +nv10_emit_point_mode(struct gl_context *ctx, int emit); void -nv10_emit_polygon_mode(GLcontext *ctx, int emit); +nv10_emit_polygon_mode(struct gl_context *ctx, int emit); void -nv10_emit_polygon_offset(GLcontext *ctx, int emit); +nv10_emit_polygon_offset(struct gl_context *ctx, int emit); void -nv10_emit_polygon_stipple(GLcontext *ctx, int emit); +nv10_emit_polygon_stipple(struct gl_context *ctx, int emit); /* nv10_state_raster.c */ void -nv10_emit_alpha_func(GLcontext *ctx, int emit); +nv10_emit_alpha_func(struct gl_context *ctx, int emit); void -nv10_emit_blend_color(GLcontext *ctx, int emit); +nv10_emit_blend_color(struct gl_context *ctx, int emit); void -nv10_emit_blend_equation(GLcontext *ctx, int emit); +nv10_emit_blend_equation(struct gl_context *ctx, int emit); void -nv10_emit_blend_func(GLcontext *ctx, int emit); +nv10_emit_blend_func(struct gl_context *ctx, int emit); void -nv10_emit_color_mask(GLcontext *ctx, int emit); +nv10_emit_color_mask(struct gl_context *ctx, int emit); void -nv10_emit_depth(GLcontext *ctx, int emit); +nv10_emit_depth(struct gl_context *ctx, int emit); void -nv10_emit_dither(GLcontext *ctx, int emit); +nv10_emit_dither(struct gl_context *ctx, int emit); void -nv10_emit_logic_opcode(GLcontext *ctx, int emit); +nv10_emit_logic_opcode(struct gl_context *ctx, int emit); void -nv10_emit_shade_model(GLcontext *ctx, int emit); +nv10_emit_shade_model(struct gl_context *ctx, int emit); void -nv10_emit_stencil_func(GLcontext *ctx, int emit); +nv10_emit_stencil_func(struct gl_context *ctx, int emit); void -nv10_emit_stencil_mask(GLcontext *ctx, int emit); +nv10_emit_stencil_mask(struct gl_context *ctx, int emit); void -nv10_emit_stencil_op(GLcontext *ctx, int emit); +nv10_emit_stencil_op(struct gl_context *ctx, int emit); /* nv10_state_frag.c */ void -nv10_get_general_combiner(GLcontext *ctx, int i, +nv10_get_general_combiner(struct gl_context *ctx, int i, uint32_t *a_in, uint32_t *a_out, uint32_t *c_in, uint32_t *c_out, uint32_t *k); void -nv10_get_final_combiner(GLcontext *ctx, uint64_t *in, int *n); +nv10_get_final_combiner(struct gl_context *ctx, uint64_t *in, int *n); void -nv10_emit_tex_env(GLcontext *ctx, int emit); +nv10_emit_tex_env(struct gl_context *ctx, int emit); void -nv10_emit_frag(GLcontext *ctx, int emit); +nv10_emit_frag(struct gl_context *ctx, int emit); /* nv10_state_tex.c */ void -nv10_emit_tex_gen(GLcontext *ctx, int emit); +nv10_emit_tex_gen(struct gl_context *ctx, int emit); void -nv10_emit_tex_mat(GLcontext *ctx, int emit); +nv10_emit_tex_mat(struct gl_context *ctx, int emit); void -nv10_emit_tex_obj(GLcontext *ctx, int emit); +nv10_emit_tex_obj(struct gl_context *ctx, int emit); /* nv10_state_tnl.c */ void -nv10_get_fog_coeff(GLcontext *ctx, float k[3]); +nv10_get_fog_coeff(struct gl_context *ctx, float k[3]); void nv10_get_spot_coeff(struct gl_light *l, float k[7]); @@ -150,42 +164,42 @@ void nv10_get_shininess_coeff(float s, float k[6]); void -nv10_emit_clip_plane(GLcontext *ctx, int emit); +nv10_emit_clip_plane(struct gl_context *ctx, int emit); void -nv10_emit_color_material(GLcontext *ctx, int emit); +nv10_emit_color_material(struct gl_context *ctx, int emit); void -nv10_emit_fog(GLcontext *ctx, int emit); +nv10_emit_fog(struct gl_context *ctx, int emit); void -nv10_emit_light_enable(GLcontext *ctx, int emit); +nv10_emit_light_enable(struct gl_context *ctx, int emit); void -nv10_emit_light_model(GLcontext *ctx, int emit); +nv10_emit_light_model(struct gl_context *ctx, int emit); void -nv10_emit_light_source(GLcontext *ctx, int emit); +nv10_emit_light_source(struct gl_context *ctx, int emit); void -nv10_emit_material_ambient(GLcontext *ctx, int emit); +nv10_emit_material_ambient(struct gl_context *ctx, int emit); void -nv10_emit_material_diffuse(GLcontext *ctx, int emit); +nv10_emit_material_diffuse(struct gl_context *ctx, int emit); void -nv10_emit_material_specular(GLcontext *ctx, int emit); +nv10_emit_material_specular(struct gl_context *ctx, int emit); void -nv10_emit_material_shininess(GLcontext *ctx, int emit); +nv10_emit_material_shininess(struct gl_context *ctx, int emit); void -nv10_emit_modelview(GLcontext *ctx, int emit); +nv10_emit_modelview(struct gl_context *ctx, int emit); void -nv10_emit_point_parameter(GLcontext *ctx, int emit); +nv10_emit_point_parameter(struct gl_context *ctx, int emit); void -nv10_emit_projection(GLcontext *ctx, int emit); +nv10_emit_projection(struct gl_context *ctx, int emit); #endif diff --git a/src/mesa/drivers/dri/nouveau/nv10_render.c b/src/mesa/drivers/dri/nouveau/nv10_render.c index 54245ea6ba..a03ace3536 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_render.c +++ b/src/mesa/drivers/dri/nouveau/nv10_render.c @@ -32,7 +32,7 @@ #define NUM_VERTEX_ATTRS 8 static void -nv10_emit_material(GLcontext *ctx, struct nouveau_array_state *a, +nv10_emit_material(struct gl_context *ctx, struct nouveau_array_state *a, const void *v); /* Vertex attribute format. */ @@ -106,7 +106,7 @@ get_hw_format(int type) } static void -nv10_render_set_format(GLcontext *ctx) +nv10_render_set_format(struct gl_context *ctx) { struct nouveau_render_state *render = to_render_state(ctx); struct nouveau_channel *chan = context_chan(ctx); @@ -136,7 +136,7 @@ nv10_render_set_format(GLcontext *ctx) } static void -nv10_render_bind_vertices(GLcontext *ctx) +nv10_render_bind_vertices(struct gl_context *ctx) { struct nouveau_render_state *render = to_render_state(ctx); struct nouveau_bo_context *bctx = context_bctx(ctx, VERTEX); @@ -167,35 +167,35 @@ nv10_render_bind_vertices(GLcontext *ctx) #define BATCH_BEGIN(prim) \ BEGIN_RING(chan, celsius, NV10TCL_VERTEX_BUFFER_BEGIN_END, 1); \ - OUT_RING(chan, prim); + OUT_RING(chan, prim) #define BATCH_END() \ BEGIN_RING(chan, celsius, NV10TCL_VERTEX_BUFFER_BEGIN_END, 1); \ - OUT_RING(chan, 0); + OUT_RING(chan, 0) #define MAX_PACKET 0x400 #define MAX_OUT_L 0x100 #define BATCH_PACKET_L(n) \ - BEGIN_RING_NI(chan, celsius, NV10TCL_VERTEX_BUFFER_DRAW_ARRAYS, n); + BEGIN_RING_NI(chan, celsius, NV10TCL_VERTEX_BUFFER_DRAW_ARRAYS, n) #define BATCH_OUT_L(i, n) \ - OUT_RING(chan, ((n) - 1) << 24 | (i)); + OUT_RING(chan, ((n) - 1) << 24 | (i)) #define MAX_OUT_I16 0x2 #define BATCH_PACKET_I16(n) \ - BEGIN_RING_NI(chan, celsius, NV10TCL_VB_ELEMENT_U16, n); + BEGIN_RING_NI(chan, celsius, NV10TCL_VB_ELEMENT_U16, n) #define BATCH_OUT_I16(i0, i1) \ - OUT_RING(chan, (i1) << 16 | (i0)); + OUT_RING(chan, (i1) << 16 | (i0)) #define MAX_OUT_I32 0x1 #define BATCH_PACKET_I32(n) \ - BEGIN_RING_NI(chan, celsius, NV10TCL_VB_ELEMENT_U32, n); + BEGIN_RING_NI(chan, celsius, NV10TCL_VB_ELEMENT_U32, n) #define BATCH_OUT_I32(i) \ - OUT_RING(chan, i); + OUT_RING(chan, i) #define IMM_PACKET(m, n) \ - BEGIN_RING(chan, celsius, m, n); + BEGIN_RING(chan, celsius, m, n) #define IMM_OUT(x) \ - OUT_RINGf(chan, x); + OUT_RINGf(chan, x) #define TAG(x) nv10_##x #include "nouveau_render_t.c" diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c index a2fcb6b695..d87fe96b1c 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c @@ -51,7 +51,7 @@ get_rt_format(gl_format format) } static void -setup_lma_buffer(GLcontext *ctx) +setup_lma_buffer(struct gl_context *ctx) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -62,14 +62,14 @@ setup_lma_buffer(GLcontext *ctx) height = align(fb->Height, 2), size = pitch * height; - if (!nfb->lma_bo || nfb->lma_bo->size != size) { - nouveau_bo_ref(NULL, &nfb->lma_bo); - nouveau_bo_new(context_dev(ctx), NOUVEAU_BO_VRAM, 0, size, - &nfb->lma_bo); + if (!nfb->hierz.bo || nfb->hierz.bo->size != size) { + nouveau_bo_ref(NULL, &nfb->hierz.bo); + nouveau_bo_new_tile(context_dev(ctx), NOUVEAU_BO_VRAM, 0, size, + 0, NOUVEAU_BO_TILE_ZETA, &nfb->hierz.bo); } nouveau_bo_markl(bctx, celsius, NV17TCL_LMA_DEPTH_BUFFER_OFFSET, - nfb->lma_bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR); + nfb->hierz.bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR); WAIT_RING(chan, 9); BEGIN_RING(chan, celsius, NV17TCL_LMA_DEPTH_WINDOW_X, 4); @@ -86,7 +86,7 @@ setup_lma_buffer(GLcontext *ctx) } void -nv10_emit_framebuffer(GLcontext *ctx, int emit) +nv10_emit_framebuffer(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -134,8 +134,10 @@ nv10_emit_framebuffer(GLcontext *ctx, int emit) nouveau_bo_markl(bctx, celsius, NV10TCL_ZETA_OFFSET, s->bo, 0, bo_flags); - if (context_chipset(ctx) >= 0x17) + if (context_chipset(ctx) >= 0x17) { setup_lma_buffer(ctx); + context_dirty(ctx, ZCLEAR); + } } BEGIN_RING(chan, celsius, NV10TCL_RT_FORMAT, 2); @@ -147,12 +149,12 @@ nv10_emit_framebuffer(GLcontext *ctx, int emit) } void -nv10_emit_render_mode(GLcontext *ctx, int emit) +nv10_emit_render_mode(struct gl_context *ctx, int emit) { } void -nv10_emit_scissor(GLcontext *ctx, int emit) +nv10_emit_scissor(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -166,16 +168,19 @@ nv10_emit_scissor(GLcontext *ctx, int emit) } void -nv10_emit_viewport(GLcontext *ctx, int emit) +nv10_emit_viewport(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); + struct gl_viewport_attrib *vp = &ctx->Viewport; struct gl_framebuffer *fb = ctx->DrawBuffer; float a[4] = {}; get_viewport_translate(ctx, a); a[0] -= 2048; a[1] -= 2048; + if (nv10_use_viewport_zclear(ctx)) + a[2] = nv10_transform_depth(ctx, (vp->Far + vp->Near) / 2); BEGIN_RING(chan, celsius, NV10TCL_VIEWPORT_TRANSLATE_X, 4); OUT_RINGp(chan, a, 4); @@ -187,3 +192,25 @@ nv10_emit_viewport(GLcontext *ctx, int emit) context_dirty(ctx, PROJECTION); } + +void +nv10_emit_zclear(struct gl_context *ctx, int emit) +{ + struct nouveau_context *nctx = to_nouveau_context(ctx); + struct nouveau_channel *chan = context_chan(ctx); + struct nouveau_grobj *celsius = context_eng3d(ctx); + struct nouveau_framebuffer *nfb = + to_nouveau_framebuffer(ctx->DrawBuffer); + + if (nfb->hierz.bo) { + BEGIN_RING(chan, celsius, NV17TCL_ZCLEAR_ENABLE, 2); + OUT_RING(chan, nctx->hierz.clear_blocked ? 0 : 1); + OUT_RING(chan, nfb->hierz.clear_value | + (nctx->hierz.clear_seq & 0xff)); + } else { + BEGIN_RING(chan, celsius, NV10TCL_DEPTH_RANGE_NEAR, 2); + OUT_RINGf(chan, nv10_transform_depth(ctx, 0)); + OUT_RINGf(chan, nv10_transform_depth(ctx, 1)); + context_dirty(ctx, VIEWPORT); + } +} diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c index ab713f9dbf..5138c36df7 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c @@ -61,7 +61,7 @@ #define RC_OUT_SUM NV10TCL_RC_OUT_RGB_SUM_OUTPUT_SPARE0 struct combiner_state { - GLcontext *ctx; + struct gl_context *ctx; int unit; GLboolean premodulate; @@ -298,7 +298,7 @@ setup_combiner(struct combiner_state *rc) } void -nv10_get_general_combiner(GLcontext *ctx, int i, +nv10_get_general_combiner(struct gl_context *ctx, int i, uint32_t *a_in, uint32_t *a_out, uint32_t *c_in, uint32_t *c_out, uint32_t *k) { @@ -328,7 +328,7 @@ nv10_get_general_combiner(GLcontext *ctx, int i, } void -nv10_get_final_combiner(GLcontext *ctx, uint64_t *in, int *n) +nv10_get_final_combiner(struct gl_context *ctx, uint64_t *in, int *n) { struct combiner_state rc = {}; @@ -366,7 +366,7 @@ nv10_get_final_combiner(GLcontext *ctx, uint64_t *in, int *n) } void -nv10_emit_tex_env(GLcontext *ctx, int emit) +nv10_emit_tex_env(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_TEX_ENV0; struct nouveau_channel *chan = context_chan(ctx); @@ -398,7 +398,7 @@ nv10_emit_tex_env(GLcontext *ctx, int emit) } void -nv10_emit_frag(GLcontext *ctx, int emit) +nv10_emit_frag(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_polygon.c b/src/mesa/drivers/dri/nouveau/nv10_state_polygon.c index deddca1011..4e49b0278c 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state_polygon.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state_polygon.c @@ -31,7 +31,7 @@ #include "nv10_driver.h" void -nv10_emit_cull_face(GLcontext *ctx, int emit) +nv10_emit_cull_face(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -47,7 +47,7 @@ nv10_emit_cull_face(GLcontext *ctx, int emit) } void -nv10_emit_front_face(GLcontext *ctx, int emit) +nv10_emit_front_face(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -58,7 +58,7 @@ nv10_emit_front_face(GLcontext *ctx, int emit) } void -nv10_emit_line_mode(GLcontext *ctx, int emit) +nv10_emit_line_mode(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -73,12 +73,12 @@ nv10_emit_line_mode(GLcontext *ctx, int emit) } void -nv10_emit_line_stipple(GLcontext *ctx, int emit) +nv10_emit_line_stipple(struct gl_context *ctx, int emit) { } void -nv10_emit_point_mode(GLcontext *ctx, int emit) +nv10_emit_point_mode(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -91,7 +91,7 @@ nv10_emit_point_mode(GLcontext *ctx, int emit) } void -nv10_emit_polygon_mode(GLcontext *ctx, int emit) +nv10_emit_polygon_mode(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -105,7 +105,7 @@ nv10_emit_polygon_mode(GLcontext *ctx, int emit) } void -nv10_emit_polygon_offset(GLcontext *ctx, int emit) +nv10_emit_polygon_offset(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -121,6 +121,6 @@ nv10_emit_polygon_offset(GLcontext *ctx, int emit) } void -nv10_emit_polygon_stipple(GLcontext *ctx, int emit) +nv10_emit_polygon_stipple(struct gl_context *ctx, int emit) { } diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_raster.c b/src/mesa/drivers/dri/nouveau/nv10_state_raster.c index a62cd807a9..99609844a1 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state_raster.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state_raster.c @@ -31,7 +31,7 @@ #include "nv10_driver.h" void -nv10_emit_alpha_func(GLcontext *ctx, int emit) +nv10_emit_alpha_func(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -45,7 +45,7 @@ nv10_emit_alpha_func(GLcontext *ctx, int emit) } void -nv10_emit_blend_color(GLcontext *ctx, int emit) +nv10_emit_blend_color(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -58,7 +58,7 @@ nv10_emit_blend_color(GLcontext *ctx, int emit) } void -nv10_emit_blend_equation(GLcontext *ctx, int emit) +nv10_emit_blend_equation(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -71,7 +71,7 @@ nv10_emit_blend_equation(GLcontext *ctx, int emit) } void -nv10_emit_blend_func(GLcontext *ctx, int emit) +nv10_emit_blend_func(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -82,7 +82,7 @@ nv10_emit_blend_func(GLcontext *ctx, int emit) } void -nv10_emit_color_mask(GLcontext *ctx, int emit) +nv10_emit_color_mask(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -95,7 +95,7 @@ nv10_emit_color_mask(GLcontext *ctx, int emit) } void -nv10_emit_depth(GLcontext *ctx, int emit) +nv10_emit_depth(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -109,7 +109,7 @@ nv10_emit_depth(GLcontext *ctx, int emit) } void -nv10_emit_dither(GLcontext *ctx, int emit) +nv10_emit_dither(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -119,7 +119,7 @@ nv10_emit_dither(GLcontext *ctx, int emit) } void -nv10_emit_logic_opcode(GLcontext *ctx, int emit) +nv10_emit_logic_opcode(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -133,7 +133,7 @@ nv10_emit_logic_opcode(GLcontext *ctx, int emit) } void -nv10_emit_shade_model(GLcontext *ctx, int emit) +nv10_emit_shade_model(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -144,7 +144,7 @@ nv10_emit_shade_model(GLcontext *ctx, int emit) } void -nv10_emit_stencil_func(GLcontext *ctx, int emit) +nv10_emit_stencil_func(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -159,7 +159,7 @@ nv10_emit_stencil_func(GLcontext *ctx, int emit) } void -nv10_emit_stencil_mask(GLcontext *ctx, int emit) +nv10_emit_stencil_mask(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -169,7 +169,7 @@ nv10_emit_stencil_mask(GLcontext *ctx, int emit) } void -nv10_emit_stencil_op(GLcontext *ctx, int emit) +nv10_emit_stencil_op(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c index 6dedb18c72..0092ad0c20 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c @@ -37,7 +37,7 @@ #define TX_MATRIX(i) (NV10TCL_TX0_MATRIX(0) + 64 * (i)) void -nv10_emit_tex_gen(GLcontext *ctx, int emit) +nv10_emit_tex_gen(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_TEX_GEN0; struct nouveau_context *nctx = to_nouveau_context(ctx); @@ -70,7 +70,7 @@ nv10_emit_tex_gen(GLcontext *ctx, int emit) } void -nv10_emit_tex_mat(GLcontext *ctx, int emit) +nv10_emit_tex_mat(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_TEX_MAT0; struct nouveau_context *nctx = to_nouveau_context(ctx); @@ -151,7 +151,7 @@ get_tex_format_rect(struct gl_texture_image *ti) } void -nv10_emit_tex_obj(GLcontext *ctx, int emit) +nv10_emit_tex_obj(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_TEX_OBJ0; struct nouveau_channel *chan = context_chan(ctx); @@ -225,7 +225,7 @@ nv10_emit_tex_obj(GLcontext *ctx, int emit) bo_flags | NOUVEAU_BO_OR); nouveau_bo_markl(bctx, celsius, NV10TCL_TX_OFFSET(i), - s->bo, 0, bo_flags); + s->bo, s->offset, bo_flags); BEGIN_RING(chan, celsius, NV10TCL_TX_FILTER(i), 1); OUT_RING(chan, tx_filter); diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c b/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c index 0e592a1629..175abfca5c 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c @@ -32,7 +32,7 @@ #include "nv10_driver.h" void -nv10_emit_clip_plane(GLcontext *ctx, int emit) +nv10_emit_clip_plane(struct gl_context *ctx, int emit) { } @@ -54,7 +54,7 @@ get_material_bitmask(unsigned m) } void -nv10_emit_color_material(GLcontext *ctx, int emit) +nv10_emit_color_material(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -93,7 +93,7 @@ get_fog_source(unsigned source) } void -nv10_get_fog_coeff(GLcontext *ctx, float k[3]) +nv10_get_fog_coeff(struct gl_context *ctx, float k[3]) { struct gl_fog_attrib *f = &ctx->Fog; @@ -121,7 +121,7 @@ nv10_get_fog_coeff(GLcontext *ctx, float k[3]) } void -nv10_emit_fog(GLcontext *ctx, int emit) +nv10_emit_fog(struct gl_context *ctx, int emit) { struct nouveau_context *nctx = to_nouveau_context(ctx); struct nouveau_channel *chan = context_chan(ctx); @@ -161,7 +161,7 @@ get_light_mode(struct gl_light *l) } void -nv10_emit_light_enable(GLcontext *ctx, int emit) +nv10_emit_light_enable(struct gl_context *ctx, int emit) { struct nouveau_context *nctx = to_nouveau_context(ctx); struct nouveau_channel *chan = context_chan(ctx); @@ -187,7 +187,7 @@ nv10_emit_light_enable(GLcontext *ctx, int emit) } void -nv10_emit_light_model(GLcontext *ctx, int emit) +nv10_emit_light_model(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -273,7 +273,7 @@ nv10_get_spot_coeff(struct gl_light *l, float k[7]) } void -nv10_emit_light_source(GLcontext *ctx, int emit) +nv10_emit_light_source(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_LIGHT_SOURCE0; struct nouveau_channel *chan = context_chan(ctx); @@ -313,7 +313,7 @@ nv10_emit_light_source(GLcontext *ctx, int emit) ctx->Light.ColorMaterialBitmask & (1 << MAT_ATTRIB_FRONT_##attr)) void -nv10_emit_material_ambient(GLcontext *ctx, int emit) +nv10_emit_material_ambient(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -355,7 +355,7 @@ nv10_emit_material_ambient(GLcontext *ctx, int emit) } void -nv10_emit_material_diffuse(GLcontext *ctx, int emit) +nv10_emit_material_diffuse(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -377,7 +377,7 @@ nv10_emit_material_diffuse(GLcontext *ctx, int emit) } void -nv10_emit_material_specular(GLcontext *ctx, int emit) +nv10_emit_material_specular(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -419,7 +419,7 @@ nv10_get_shininess_coeff(float s, float k[6]) } void -nv10_emit_material_shininess(GLcontext *ctx, int emit) +nv10_emit_material_shininess(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *celsius = context_eng3d(ctx); @@ -435,7 +435,7 @@ nv10_emit_material_shininess(GLcontext *ctx, int emit) } void -nv10_emit_modelview(GLcontext *ctx, int emit) +nv10_emit_modelview(struct gl_context *ctx, int emit) { struct nouveau_context *nctx = to_nouveau_context(ctx); struct nouveau_channel *chan = context_chan(ctx); @@ -464,12 +464,12 @@ nv10_emit_modelview(GLcontext *ctx, int emit) } void -nv10_emit_point_parameter(GLcontext *ctx, int emit) +nv10_emit_point_parameter(struct gl_context *ctx, int emit) { } void -nv10_emit_projection(GLcontext *ctx, int emit) +nv10_emit_projection(struct gl_context *ctx, int emit) { struct nouveau_context *nctx = to_nouveau_context(ctx); struct nouveau_channel *chan = context_chan(ctx); @@ -479,6 +479,9 @@ nv10_emit_projection(GLcontext *ctx, int emit) _math_matrix_ctr(&m); get_viewport_scale(ctx, m.m); + if (nv10_use_viewport_zclear(ctx)) + m.m[MAT_SZ] /= 8; + if (nctx->fallback == HWTNL) _math_matrix_mul_matrix(&m, &m, &ctx->_ModelProjectMatrix); diff --git a/src/mesa/drivers/dri/nouveau/nv20_context.c b/src/mesa/drivers/dri/nouveau/nv20_context.c index b9c221e716..c6111a2a9a 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_context.c +++ b/src/mesa/drivers/dri/nouveau/nv20_context.c @@ -40,7 +40,7 @@ static const struct dri_extension nv20_extensions[] = { }; static void -nv20_hwctx_init(GLcontext *ctx) +nv20_hwctx_init(struct gl_context *ctx) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *kelvin = context_eng3d(ctx); @@ -371,7 +371,7 @@ nv20_hwctx_init(GLcontext *ctx) } static void -nv20_context_destroy(GLcontext *ctx) +nv20_context_destroy(struct gl_context *ctx) { struct nouveau_context *nctx = to_nouveau_context(ctx); @@ -384,12 +384,12 @@ nv20_context_destroy(GLcontext *ctx) FREE(ctx); } -static GLcontext * -nv20_context_create(struct nouveau_screen *screen, const GLvisual *visual, - GLcontext *share_ctx) +static struct gl_context * +nv20_context_create(struct nouveau_screen *screen, const struct gl_config *visual, + struct gl_context *share_ctx) { struct nouveau_context *nctx; - GLcontext *ctx; + struct gl_context *ctx; unsigned kelvin_class; int ret; diff --git a/src/mesa/drivers/dri/nouveau/nv20_driver.h b/src/mesa/drivers/dri/nouveau/nv20_driver.h index 8adecef2c4..7fbe6ccfa6 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_driver.h +++ b/src/mesa/drivers/dri/nouveau/nv20_driver.h @@ -39,78 +39,78 @@ extern const struct nouveau_driver nv20_driver; /* nv20_render.c */ void -nv20_render_init(GLcontext *ctx); +nv20_render_init(struct gl_context *ctx); void -nv20_render_destroy(GLcontext *ctx); +nv20_render_destroy(struct gl_context *ctx); /* nv20_state_fb.c */ void -nv20_emit_framebuffer(GLcontext *ctx, int emit); +nv20_emit_framebuffer(struct gl_context *ctx, int emit); void -nv20_emit_viewport(GLcontext *ctx, int emit); +nv20_emit_viewport(struct gl_context *ctx, int emit); /* nv20_state_polygon.c */ void -nv20_emit_point_mode(GLcontext *ctx, int emit); +nv20_emit_point_mode(struct gl_context *ctx, int emit); /* nv20_state_raster.c */ void -nv20_emit_logic_opcode(GLcontext *ctx, int emit); +nv20_emit_logic_opcode(struct gl_context *ctx, int emit); /* nv20_state_frag.c */ void -nv20_emit_tex_env(GLcontext *ctx, int emit); +nv20_emit_tex_env(struct gl_context *ctx, int emit); void -nv20_emit_frag(GLcontext *ctx, int emit); +nv20_emit_frag(struct gl_context *ctx, int emit); /* nv20_state_tex.c */ void -nv20_emit_tex_gen(GLcontext *ctx, int emit); +nv20_emit_tex_gen(struct gl_context *ctx, int emit); void -nv20_emit_tex_mat(GLcontext *ctx, int emit); +nv20_emit_tex_mat(struct gl_context *ctx, int emit); void -nv20_emit_tex_obj(GLcontext *ctx, int emit); +nv20_emit_tex_obj(struct gl_context *ctx, int emit); void -nv20_emit_tex_shader(GLcontext *ctx, int emit); +nv20_emit_tex_shader(struct gl_context *ctx, int emit); /* nv20_state_tnl.c */ void -nv20_emit_clip_plane(GLcontext *ctx, int emit); +nv20_emit_clip_plane(struct gl_context *ctx, int emit); void -nv20_emit_color_material(GLcontext *ctx, int emit); +nv20_emit_color_material(struct gl_context *ctx, int emit); void -nv20_emit_fog(GLcontext *ctx, int emit); +nv20_emit_fog(struct gl_context *ctx, int emit); void -nv20_emit_light_model(GLcontext *ctx, int emit); +nv20_emit_light_model(struct gl_context *ctx, int emit); void -nv20_emit_light_source(GLcontext *ctx, int emit); +nv20_emit_light_source(struct gl_context *ctx, int emit); void -nv20_emit_material_ambient(GLcontext *ctx, int emit); +nv20_emit_material_ambient(struct gl_context *ctx, int emit); void -nv20_emit_material_diffuse(GLcontext *ctx, int emit); +nv20_emit_material_diffuse(struct gl_context *ctx, int emit); void -nv20_emit_material_specular(GLcontext *ctx, int emit); +nv20_emit_material_specular(struct gl_context *ctx, int emit); void -nv20_emit_material_shininess(GLcontext *ctx, int emit); +nv20_emit_material_shininess(struct gl_context *ctx, int emit); void -nv20_emit_modelview(GLcontext *ctx, int emit); +nv20_emit_modelview(struct gl_context *ctx, int emit); void -nv20_emit_projection(GLcontext *ctx, int emit); +nv20_emit_projection(struct gl_context *ctx, int emit); #endif diff --git a/src/mesa/drivers/dri/nouveau/nv20_render.c b/src/mesa/drivers/dri/nouveau/nv20_render.c index a696ac107f..6b66854462 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_render.c +++ b/src/mesa/drivers/dri/nouveau/nv20_render.c @@ -32,7 +32,7 @@ #define NUM_VERTEX_ATTRS 16 static void -nv20_emit_material(GLcontext *ctx, struct nouveau_array_state *a, +nv20_emit_material(struct gl_context *ctx, struct nouveau_array_state *a, const void *v); /* Vertex attribute format. */ @@ -130,7 +130,7 @@ get_hw_format(int type) } static void -nv20_render_set_format(GLcontext *ctx) +nv20_render_set_format(struct gl_context *ctx) { struct nouveau_render_state *render = to_render_state(ctx); struct nouveau_channel *chan = context_chan(ctx); @@ -158,7 +158,7 @@ nv20_render_set_format(GLcontext *ctx) } static void -nv20_render_bind_vertices(GLcontext *ctx) +nv20_render_bind_vertices(struct gl_context *ctx) { struct nouveau_render_state *render = to_render_state(ctx); struct nouveau_bo_context *bctx = context_bctx(ctx, VERTEX); @@ -191,35 +191,35 @@ nv20_render_bind_vertices(GLcontext *ctx) #define BATCH_BEGIN(prim) \ BEGIN_RING(chan, kelvin, NV20TCL_VERTEX_BEGIN_END, 1); \ - OUT_RING(chan, prim); + OUT_RING(chan, prim) #define BATCH_END() \ BEGIN_RING(chan, kelvin, NV20TCL_VERTEX_BEGIN_END, 1); \ - OUT_RING(chan, 0); + OUT_RING(chan, 0) #define MAX_PACKET 0x400 #define MAX_OUT_L 0x100 #define BATCH_PACKET_L(n) \ - BEGIN_RING_NI(chan, kelvin, NV20TCL_VB_VERTEX_BATCH, n); + BEGIN_RING_NI(chan, kelvin, NV20TCL_VB_VERTEX_BATCH, n) #define BATCH_OUT_L(i, n) \ - OUT_RING(chan, ((n) - 1) << 24 | (i)); + OUT_RING(chan, ((n) - 1) << 24 | (i)) #define MAX_OUT_I16 0x2 #define BATCH_PACKET_I16(n) \ - BEGIN_RING_NI(chan, kelvin, NV20TCL_VB_ELEMENT_U16, n); + BEGIN_RING_NI(chan, kelvin, NV20TCL_VB_ELEMENT_U16, n) #define BATCH_OUT_I16(i0, i1) \ - OUT_RING(chan, (i1) << 16 | (i0)); + OUT_RING(chan, (i1) << 16 | (i0)) #define MAX_OUT_I32 0x1 #define BATCH_PACKET_I32(n) \ - BEGIN_RING_NI(chan, kelvin, NV20TCL_VB_ELEMENT_U32, n); + BEGIN_RING_NI(chan, kelvin, NV20TCL_VB_ELEMENT_U32, n) #define BATCH_OUT_I32(i) \ - OUT_RING(chan, i); + OUT_RING(chan, i) #define IMM_PACKET(m, n) \ - BEGIN_RING(chan, kelvin, m, n); + BEGIN_RING(chan, kelvin, m, n) #define IMM_OUT(x) \ - OUT_RINGf(chan, x); + OUT_RINGf(chan, x) #define TAG(x) nv20_##x #include "nouveau_render_t.c" diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_fb.c b/src/mesa/drivers/dri/nouveau/nv20_state_fb.c index 95691cad04..7822ca2a09 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state_fb.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state_fb.c @@ -52,7 +52,7 @@ get_rt_format(gl_format format) } void -nv20_emit_framebuffer(GLcontext *ctx, int emit) +nv20_emit_framebuffer(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *kelvin = context_eng3d(ctx); @@ -103,7 +103,7 @@ nv20_emit_framebuffer(GLcontext *ctx, int emit) } void -nv20_emit_viewport(GLcontext *ctx, int emit) +nv20_emit_viewport(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *kelvin = context_eng3d(ctx); diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_frag.c b/src/mesa/drivers/dri/nouveau/nv20_state_frag.c index 74803d2ae8..f9212d8b39 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state_frag.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state_frag.c @@ -31,7 +31,7 @@ #include "nv20_driver.h" void -nv20_emit_tex_env(GLcontext *ctx, int emit) +nv20_emit_tex_env(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_TEX_ENV0; struct nouveau_channel *chan = context_chan(ctx); @@ -55,7 +55,7 @@ nv20_emit_tex_env(GLcontext *ctx, int emit) } void -nv20_emit_frag(GLcontext *ctx, int emit) +nv20_emit_frag(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *kelvin = context_eng3d(ctx); diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_polygon.c b/src/mesa/drivers/dri/nouveau/nv20_state_polygon.c index 3a320e2dac..a6e237f8c4 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state_polygon.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state_polygon.c @@ -31,7 +31,7 @@ #include "nv20_driver.h" void -nv20_emit_point_mode(GLcontext *ctx, int emit) +nv20_emit_point_mode(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *kelvin = context_eng3d(ctx); diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_raster.c b/src/mesa/drivers/dri/nouveau/nv20_state_raster.c index b43b29bb23..0fc7a3259d 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state_raster.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state_raster.c @@ -31,7 +31,7 @@ #include "nv20_driver.h" void -nv20_emit_logic_opcode(GLcontext *ctx, int emit) +nv20_emit_logic_opcode(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *kelvin = context_eng3d(ctx); diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c index 2d45513bb4..cfff1fe839 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c @@ -37,7 +37,7 @@ #define TX_MATRIX(i) (NV20TCL_TX0_MATRIX(0) + 64 * (i)) void -nv20_emit_tex_gen(GLcontext *ctx, int emit) +nv20_emit_tex_gen(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_TEX_GEN0; struct nouveau_context *nctx = to_nouveau_context(ctx); @@ -67,7 +67,7 @@ nv20_emit_tex_gen(GLcontext *ctx, int emit) } void -nv20_emit_tex_mat(GLcontext *ctx, int emit) +nv20_emit_tex_mat(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_TEX_MAT0; struct nouveau_context *nctx = to_nouveau_context(ctx); @@ -154,7 +154,7 @@ get_tex_format_rect(struct gl_texture_image *ti) } void -nv20_emit_tex_obj(GLcontext *ctx, int emit) +nv20_emit_tex_obj(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_TEX_OBJ0; struct nouveau_channel *chan = context_chan(ctx); @@ -236,7 +236,7 @@ nv20_emit_tex_obj(GLcontext *ctx, int emit) bo_flags | NOUVEAU_BO_OR); nouveau_bo_markl(bctx, kelvin, NV20TCL_TX_OFFSET(i), - s->bo, 0, bo_flags); + s->bo, s->offset, bo_flags); BEGIN_RING(chan, kelvin, NV20TCL_TX_WRAP(i), 1); OUT_RING(chan, tx_wrap); @@ -251,7 +251,7 @@ nv20_emit_tex_obj(GLcontext *ctx, int emit) } void -nv20_emit_tex_shader(GLcontext *ctx, int emit) +nv20_emit_tex_shader(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *kelvin = context_eng3d(ctx); diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c b/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c index 2daaae260c..b65cd9ad87 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c @@ -55,7 +55,7 @@ NV20TCL_FRONT_MATERIAL_SHININESS(0)) void -nv20_emit_clip_plane(GLcontext *ctx, int emit) +nv20_emit_clip_plane(struct gl_context *ctx, int emit) { } @@ -86,7 +86,7 @@ get_material_bitmask(unsigned m) } void -nv20_emit_color_material(GLcontext *ctx, int emit) +nv20_emit_color_material(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *kelvin = context_eng3d(ctx); @@ -140,7 +140,7 @@ get_fog_source(unsigned source) } void -nv20_emit_fog(GLcontext *ctx, int emit) +nv20_emit_fog(struct gl_context *ctx, int emit) { struct nouveau_context *nctx = to_nouveau_context(ctx); struct nouveau_channel *chan = context_chan(ctx); @@ -165,7 +165,7 @@ nv20_emit_fog(GLcontext *ctx, int emit) } void -nv20_emit_light_model(GLcontext *ctx, int emit) +nv20_emit_light_model(struct gl_context *ctx, int emit) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *kelvin = context_eng3d(ctx); @@ -187,7 +187,7 @@ nv20_emit_light_model(GLcontext *ctx, int emit) } void -nv20_emit_light_source(GLcontext *ctx, int emit) +nv20_emit_light_source(struct gl_context *ctx, int emit) { const int i = emit - NOUVEAU_STATE_LIGHT_SOURCE0; struct nouveau_channel *chan = context_chan(ctx); @@ -226,7 +226,7 @@ nv20_emit_light_source(GLcontext *ctx, int emit) ctx->Light.ColorMaterialBitmask & (1 << MAT_ATTRIB_##attr(side))) void -nv20_emit_material_ambient(GLcontext *ctx, int emit) +nv20_emit_material_ambient(struct gl_context *ctx, int emit) { const int side = emit - NOUVEAU_STATE_MATERIAL_FRONT_AMBIENT; struct nouveau_channel *chan = context_chan(ctx); @@ -269,7 +269,7 @@ nv20_emit_material_ambient(GLcontext *ctx, int emit) } void -nv20_emit_material_diffuse(GLcontext *ctx, int emit) +nv20_emit_material_diffuse(struct gl_context *ctx, int emit) { const int side = emit - NOUVEAU_STATE_MATERIAL_FRONT_DIFFUSE; struct nouveau_channel *chan = context_chan(ctx); @@ -292,7 +292,7 @@ nv20_emit_material_diffuse(GLcontext *ctx, int emit) } void -nv20_emit_material_specular(GLcontext *ctx, int emit) +nv20_emit_material_specular(struct gl_context *ctx, int emit) { const int side = emit - NOUVEAU_STATE_MATERIAL_FRONT_SPECULAR; struct nouveau_channel *chan = context_chan(ctx); @@ -311,7 +311,7 @@ nv20_emit_material_specular(GLcontext *ctx, int emit) } void -nv20_emit_material_shininess(GLcontext *ctx, int emit) +nv20_emit_material_shininess(struct gl_context *ctx, int emit) { const int side = emit - NOUVEAU_STATE_MATERIAL_FRONT_SHININESS; struct nouveau_channel *chan = context_chan(ctx); @@ -328,7 +328,7 @@ nv20_emit_material_shininess(GLcontext *ctx, int emit) } void -nv20_emit_modelview(GLcontext *ctx, int emit) +nv20_emit_modelview(struct gl_context *ctx, int emit) { struct nouveau_context *nctx = to_nouveau_context(ctx); struct nouveau_channel *chan = context_chan(ctx); @@ -357,7 +357,7 @@ nv20_emit_modelview(GLcontext *ctx, int emit) } void -nv20_emit_projection(GLcontext *ctx, int emit) +nv20_emit_projection(struct gl_context *ctx, int emit) { struct nouveau_context *nctx = to_nouveau_context(ctx); struct nouveau_channel *chan = context_chan(ctx); diff --git a/src/mesa/drivers/dri/r128/r128_context.c b/src/mesa/drivers/dri/r128/r128_context.c index 7860708383..274108005f 100644 --- a/src/mesa/drivers/dri/r128/r128_context.c +++ b/src/mesa/drivers/dri/r128/r128_context.c @@ -81,7 +81,6 @@ static const struct dri_extension card_extensions[] = { "GL_EXT_stencil_wrap", NULL }, { "GL_MESA_ycbcr_texture", NULL }, { "GL_NV_blend_square", NULL }, - { "GL_SGIS_generate_mipmap", NULL }, { NULL, NULL } }; @@ -100,11 +99,11 @@ static const struct dri_debug_control debug_control[] = /* Create the device specific context. */ GLboolean r128CreateContext( gl_api api, - const __GLcontextModes *glVisual, + const struct gl_config *glVisual, __DRIcontext *driContextPriv, void *sharedContextPrivate ) { - GLcontext *ctx, *shareCtx; + struct gl_context *ctx, *shareCtx; __DRIscreen *sPriv = driContextPriv->driScreenPriv; struct dd_function_table functions; r128ContextPtr rmesa; @@ -349,8 +348,8 @@ r128MakeCurrent( __DRIcontext *driContextPriv, newR128Ctx->driDrawable = driDrawPriv; _mesa_make_current( newR128Ctx->glCtx, - (GLframebuffer *) driDrawPriv->driverPrivate, - (GLframebuffer *) driReadPriv->driverPrivate ); + (struct gl_framebuffer *) driDrawPriv->driverPrivate, + (struct gl_framebuffer *) driReadPriv->driverPrivate ); newR128Ctx->new_state |= R128_NEW_WINDOW | R128_NEW_CLIP; } else { diff --git a/src/mesa/drivers/dri/r128/r128_context.h b/src/mesa/drivers/dri/r128/r128_context.h index 65ddb3bd23..0a06c43878 100644 --- a/src/mesa/drivers/dri/r128/r128_context.h +++ b/src/mesa/drivers/dri/r128/r128_context.h @@ -113,7 +113,7 @@ typedef void (*r128_point_func)( r128ContextPtr, struct r128_context { - GLcontext *glCtx; /* Mesa context */ + struct gl_context *glCtx; /* Mesa context */ /* Driver and hardware state management */ @@ -225,7 +225,7 @@ struct r128_context { extern GLboolean r128CreateContext( gl_api api, - const __GLcontextModes *glVisual, + const struct gl_config *glVisual, __DRIcontext *driContextPriv, void *sharedContextPrivate ); diff --git a/src/mesa/drivers/dri/r128/r128_dd.c b/src/mesa/drivers/dri/r128/r128_dd.c index 64dec70cdd..0b7005eba6 100644 --- a/src/mesa/drivers/dri/r128/r128_dd.c +++ b/src/mesa/drivers/dri/r128/r128_dd.c @@ -45,7 +45,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* Return the width and height of the current color buffer. */ -static void r128GetBufferSize( GLframebuffer *buffer, +static void r128GetBufferSize( struct gl_framebuffer *buffer, GLuint *width, GLuint *height ) { GET_CURRENT_CONTEXT(ctx); @@ -59,7 +59,7 @@ static void r128GetBufferSize( GLframebuffer *buffer, /* Return various strings for glGetString(). */ -static const GLubyte *r128GetString( GLcontext *ctx, GLenum name ) +static const GLubyte *r128GetString( struct gl_context *ctx, GLenum name ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); static char buffer[128]; @@ -97,7 +97,7 @@ static const GLubyte *r128GetString( GLcontext *ctx, GLenum name ) * hardware. All commands that are normally sent to the ring are * already considered `flushed'. */ -static void r128Flush( GLcontext *ctx ) +static void r128Flush( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -118,7 +118,7 @@ static void r128Flush( GLcontext *ctx ) /* Make sure all commands have been sent to the hardware and have * completed processing. */ -static void r128Finish( GLcontext *ctx ) +static void r128Finish( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/r128/r128_ioctl.c b/src/mesa/drivers/dri/r128/r128_ioctl.c index 56758d971c..950e1d4fbd 100644 --- a/src/mesa/drivers/dri/r128/r128_ioctl.c +++ b/src/mesa/drivers/dri/r128/r128_ioctl.c @@ -398,7 +398,7 @@ void r128PageFlip( __DRIdrawable *dPriv ) * Buffer clear */ -static void r128Clear( GLcontext *ctx, GLbitfield mask ) +static void r128Clear( struct gl_context *ctx, GLbitfield mask ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); __DRIdrawable *dPriv = rmesa->driDrawable; diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index 7626a159d6..bbcb6ee180 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -262,7 +262,7 @@ r128DestroyScreen( __DRIscreen *sPriv ) static GLboolean r128CreateBuffer( __DRIscreen *driScrnPriv, __DRIdrawable *driDrawPriv, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, GLboolean isPixmap ) { r128ScreenPtr screen = (r128ScreenPtr) driScrnPriv->private; @@ -349,7 +349,7 @@ r128CreateBuffer( __DRIscreen *driScrnPriv, static void r128DestroyBuffer(__DRIdrawable *driDrawPriv) { - _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL); + _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL); } @@ -359,7 +359,7 @@ r128SwapBuffers(__DRIdrawable *dPriv) { if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) { r128ContextPtr rmesa; - GLcontext *ctx; + struct gl_context *ctx; rmesa = (r128ContextPtr) dPriv->driContextPriv->driverPrivate; ctx = rmesa->glCtx; if (ctx->Visual.doubleBufferMode) { @@ -400,7 +400,7 @@ r128FillInModes( __DRIscreen *psp, unsigned stencil_bits, GLboolean have_back_buffer ) { __DRIconfig **configs; - __GLcontextModes * m; + struct gl_config * m; unsigned depth_buffer_factor; unsigned back_buffer_factor; GLenum fb_format; @@ -473,7 +473,7 @@ r128FillInModes( __DRIscreen *psp, * * \todo maybe fold this into intelInitDriver * - * \return the __GLcontextModes supported by this driver + * \return the struct gl_config supported by this driver */ static const __DRIconfig ** r128InitScreen(__DRIscreen *psp) diff --git a/src/mesa/drivers/dri/r128/r128_span.c b/src/mesa/drivers/dri/r128/r128_span.c index 2fbe93c590..307de56ee1 100644 --- a/src/mesa/drivers/dri/r128/r128_span.c +++ b/src/mesa/drivers/dri/r128/r128_span.c @@ -400,7 +400,7 @@ do { \ #include "stenciltmp.h" static void -r128SpanRenderStart( GLcontext *ctx ) +r128SpanRenderStart( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); FLUSH_BATCH(rmesa); @@ -409,7 +409,7 @@ r128SpanRenderStart( GLcontext *ctx ) } static void -r128SpanRenderFinish( GLcontext *ctx ) +r128SpanRenderFinish( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); _swrast_flush( ctx ); @@ -417,7 +417,7 @@ r128SpanRenderFinish( GLcontext *ctx ) UNLOCK_HARDWARE( rmesa ); } -void r128DDInitSpanFuncs( GLcontext *ctx ) +void r128DDInitSpanFuncs( struct gl_context *ctx ) { struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx); swdd->SpanRenderStart = r128SpanRenderStart; @@ -429,7 +429,7 @@ void r128DDInitSpanFuncs( GLcontext *ctx ) * Plug in the Get/Put routines for the given driRenderbuffer. */ void -r128SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis) +r128SetSpanFunctions(driRenderbuffer *drb, const struct gl_config *vis) { if (drb->Base.Format == MESA_FORMAT_RGB565) { r128InitPointers_RGB565(&drb->Base); diff --git a/src/mesa/drivers/dri/r128/r128_span.h b/src/mesa/drivers/dri/r128/r128_span.h index 9af4058129..adb571d4d0 100644 --- a/src/mesa/drivers/dri/r128/r128_span.h +++ b/src/mesa/drivers/dri/r128/r128_span.h @@ -37,9 +37,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "drirenderbuffer.h" -extern void r128DDInitSpanFuncs( GLcontext *ctx ); +extern void r128DDInitSpanFuncs( struct gl_context *ctx ); extern void -r128SetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis); +r128SetSpanFunctions(driRenderbuffer *rb, const struct gl_config *vis); #endif diff --git a/src/mesa/drivers/dri/r128/r128_state.c b/src/mesa/drivers/dri/r128/r128_state.c index 9ad25f7f46..4a49e8fc70 100644 --- a/src/mesa/drivers/dri/r128/r128_state.c +++ b/src/mesa/drivers/dri/r128/r128_state.c @@ -125,7 +125,7 @@ static int blend_factor( r128ContextPtr rmesa, GLenum factor, GLboolean is_src ) } -static void r128UpdateAlphaMode( GLcontext *ctx ) +static void r128UpdateAlphaMode( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); GLuint a = rmesa->setup.misc_3d_state_cntl_reg; @@ -209,7 +209,7 @@ static void r128UpdateAlphaMode( GLcontext *ctx ) } } -static void r128DDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) +static void r128DDAlphaFunc( struct gl_context *ctx, GLenum func, GLfloat ref ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -217,7 +217,7 @@ static void r128DDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) rmesa->new_state |= R128_NEW_ALPHA; } -static void r128DDBlendEquationSeparate( GLcontext *ctx, +static void r128DDBlendEquationSeparate( struct gl_context *ctx, GLenum modeRGB, GLenum modeA ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -239,7 +239,7 @@ static void r128DDBlendEquationSeparate( GLcontext *ctx, rmesa->new_state |= R128_NEW_ALPHA; } -static void r128DDBlendFuncSeparate( GLcontext *ctx, +static void r128DDBlendFuncSeparate( struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) { @@ -254,7 +254,7 @@ static void r128DDBlendFuncSeparate( GLcontext *ctx, */ static void -r128DDStencilFuncSeparate( GLcontext *ctx, GLenum face, GLenum func, +r128DDStencilFuncSeparate( struct gl_context *ctx, GLenum face, GLenum func, GLint ref, GLuint mask ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -302,7 +302,7 @@ r128DDStencilFuncSeparate( GLcontext *ctx, GLenum face, GLenum func, } static void -r128DDStencilMaskSeparate( GLcontext *ctx, GLenum face, GLuint mask ) +r128DDStencilMaskSeparate( struct gl_context *ctx, GLenum face, GLuint mask ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); GLuint refmask = (((ctx->Stencil.Ref[0] & 0xff) << 0) | @@ -315,7 +315,7 @@ r128DDStencilMaskSeparate( GLcontext *ctx, GLenum face, GLuint mask ) } } -static void r128DDStencilOpSeparate( GLcontext *ctx, GLenum face, GLenum fail, +static void r128DDStencilOpSeparate( struct gl_context *ctx, GLenum face, GLenum fail, GLenum zfail, GLenum zpass ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -414,7 +414,7 @@ static void r128DDStencilOpSeparate( GLcontext *ctx, GLenum face, GLenum fail, } } -static void r128DDClearStencil( GLcontext *ctx, GLint s ) +static void r128DDClearStencil( struct gl_context *ctx, GLint s ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -428,7 +428,7 @@ static void r128DDClearStencil( GLcontext *ctx, GLint s ) * Depth testing */ -static void r128UpdateZMode( GLcontext *ctx ) +static void r128UpdateZMode( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); GLuint z = rmesa->setup.z_sten_cntl_c; @@ -485,7 +485,7 @@ static void r128UpdateZMode( GLcontext *ctx ) } } -static void r128DDDepthFunc( GLcontext *ctx, GLenum func ) +static void r128DDDepthFunc( struct gl_context *ctx, GLenum func ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -493,7 +493,7 @@ static void r128DDDepthFunc( GLcontext *ctx, GLenum func ) rmesa->new_state |= R128_NEW_DEPTH; } -static void r128DDDepthMask( GLcontext *ctx, GLboolean flag ) +static void r128DDDepthMask( struct gl_context *ctx, GLboolean flag ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -501,7 +501,7 @@ static void r128DDDepthMask( GLcontext *ctx, GLboolean flag ) rmesa->new_state |= R128_NEW_DEPTH; } -static void r128DDClearDepth( GLcontext *ctx, GLclampd d ) +static void r128DDClearDepth( struct gl_context *ctx, GLclampd d ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -524,7 +524,7 @@ static void r128DDClearDepth( GLcontext *ctx, GLclampd d ) * Fog */ -static void r128UpdateFogAttrib( GLcontext *ctx ) +static void r128UpdateFogAttrib( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); GLuint t = rmesa->setup.tex_cntl_c; @@ -553,7 +553,7 @@ static void r128UpdateFogAttrib( GLcontext *ctx ) } } -static void r128DDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) +static void r128DDFogfv( struct gl_context *ctx, GLenum pname, const GLfloat *param ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -566,7 +566,7 @@ static void r128DDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) * Clipping */ -static void r128UpdateClipping( GLcontext *ctx ) +static void r128UpdateClipping( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -622,7 +622,7 @@ static void r128UpdateClipping( GLcontext *ctx ) } } -static void r128DDScissor( GLcontext *ctx, +static void r128DDScissor( struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -636,7 +636,7 @@ static void r128DDScissor( GLcontext *ctx, * Culling */ -static void r128UpdateCull( GLcontext *ctx ) +static void r128UpdateCull( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); GLuint f = rmesa->setup.pm4_vc_fpu_setup; @@ -675,7 +675,7 @@ static void r128UpdateCull( GLcontext *ctx ) } } -static void r128DDCullFace( GLcontext *ctx, GLenum mode ) +static void r128DDCullFace( struct gl_context *ctx, GLenum mode ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -683,7 +683,7 @@ static void r128DDCullFace( GLcontext *ctx, GLenum mode ) rmesa->new_state |= R128_NEW_CULL; } -static void r128DDFrontFace( GLcontext *ctx, GLenum mode ) +static void r128DDFrontFace( struct gl_context *ctx, GLenum mode ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -696,7 +696,7 @@ static void r128DDFrontFace( GLcontext *ctx, GLenum mode ) * Masks */ -static void r128UpdateMasks( GLcontext *ctx ) +static void r128UpdateMasks( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -712,7 +712,7 @@ static void r128UpdateMasks( GLcontext *ctx ) } } -static void r128DDColorMask( GLcontext *ctx, +static void r128DDColorMask( struct gl_context *ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) { @@ -731,7 +731,7 @@ static void r128DDColorMask( GLcontext *ctx, * sense to break them out of the core texture state update routines. */ -static void updateSpecularLighting( GLcontext *ctx ) +static void updateSpecularLighting( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); GLuint t = rmesa->setup.tex_cntl_c; @@ -761,7 +761,7 @@ static void updateSpecularLighting( GLcontext *ctx ) } -static void r128DDLightModelfv( GLcontext *ctx, GLenum pname, +static void r128DDLightModelfv( struct gl_context *ctx, GLenum pname, const GLfloat *param ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -777,7 +777,7 @@ static void r128DDLightModelfv( GLcontext *ctx, GLenum pname, } } -static void r128DDShadeModel( GLcontext *ctx, GLenum mode ) +static void r128DDShadeModel( struct gl_context *ctx, GLenum mode ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); GLuint s = rmesa->setup.pm4_vc_fpu_setup; @@ -811,7 +811,7 @@ static void r128DDShadeModel( GLcontext *ctx, GLenum mode ) * Window position */ -static void r128UpdateWindow( GLcontext *ctx ) +static void r128UpdateWindow( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); int x = rmesa->driDrawable->x; @@ -834,7 +834,7 @@ static void r128UpdateWindow( GLcontext *ctx ) * Viewport */ -static void r128CalcViewport( GLcontext *ctx ) +static void r128CalcViewport( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); const GLfloat *v = ctx->Viewport._WindowMap.m; @@ -850,14 +850,14 @@ static void r128CalcViewport( GLcontext *ctx ) m[MAT_TZ] = v[MAT_TZ] * rmesa->depth_scale; } -static void r128Viewport( GLcontext *ctx, +static void r128Viewport( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) { r128CalcViewport( ctx ); } -static void r128DepthRange( GLcontext *ctx, +static void r128DepthRange( struct gl_context *ctx, GLclampd nearval, GLclampd farval ) { r128CalcViewport( ctx ); @@ -868,7 +868,7 @@ static void r128DepthRange( GLcontext *ctx, * Miscellaneous */ -static void r128DDClearColor( GLcontext *ctx, +static void r128DDClearColor( struct gl_context *ctx, const GLfloat color[4] ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -883,7 +883,7 @@ static void r128DDClearColor( GLcontext *ctx, c[0], c[1], c[2], c[3] ); } -static void r128DDLogicOpCode( GLcontext *ctx, GLenum opcode ) +static void r128DDLogicOpCode( struct gl_context *ctx, GLenum opcode ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -894,7 +894,7 @@ static void r128DDLogicOpCode( GLcontext *ctx, GLenum opcode ) } } -static void r128DDDrawBuffer( GLcontext *ctx, GLenum mode ) +static void r128DDDrawBuffer( struct gl_context *ctx, GLenum mode ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -921,7 +921,7 @@ static void r128DDDrawBuffer( GLcontext *ctx, GLenum mode ) rmesa->new_state |= R128_NEW_WINDOW; } -static void r128DDReadBuffer( GLcontext *ctx, GLenum mode ) +static void r128DDReadBuffer( struct gl_context *ctx, GLenum mode ) { /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */ } @@ -931,7 +931,7 @@ static void r128DDReadBuffer( GLcontext *ctx, GLenum mode ) * Polygon stipple */ -static void r128DDPolygonStipple( GLcontext *ctx, const GLubyte *mask ) +static void r128DDPolygonStipple( struct gl_context *ctx, const GLubyte *mask ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); GLuint stipple[32], i; @@ -962,7 +962,7 @@ static void r128DDPolygonStipple( GLcontext *ctx, const GLubyte *mask ) * Render mode */ -static void r128DDRenderMode( GLcontext *ctx, GLenum mode ) +static void r128DDRenderMode( struct gl_context *ctx, GLenum mode ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); FALLBACK( rmesa, R128_FALLBACK_RENDER_MODE, (mode != GL_RENDER) ); @@ -974,7 +974,7 @@ static void r128DDRenderMode( GLcontext *ctx, GLenum mode ) * State enable/disable */ -static void r128DDEnable( GLcontext *ctx, GLenum cap, GLboolean state ) +static void r128DDEnable( struct gl_context *ctx, GLenum cap, GLboolean state ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -1206,7 +1206,7 @@ static void r128DDPrintState( const char *msg, GLuint flags ) (flags & R128_NEW_WINDOW) ? "window, " : "" ); } -void r128DDUpdateHWState( GLcontext *ctx ) +void r128DDUpdateHWState( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); int new_state = rmesa->new_state; @@ -1253,7 +1253,7 @@ void r128DDUpdateHWState( GLcontext *ctx ) } -static void r128DDInvalidateState( GLcontext *ctx, GLuint new_state ) +static void r128DDInvalidateState( struct gl_context *ctx, GLuint new_state ) { _swrast_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); @@ -1404,7 +1404,7 @@ void r128DDInitState( r128ContextPtr rmesa ) /* Initialize the driver's state functions. */ -void r128DDInitStateFuncs( GLcontext *ctx ) +void r128DDInitStateFuncs( struct gl_context *ctx ) { ctx->Driver.UpdateState = r128DDInvalidateState; diff --git a/src/mesa/drivers/dri/r128/r128_state.h b/src/mesa/drivers/dri/r128/r128_state.h index a44327dfb3..55b0cbf4b7 100644 --- a/src/mesa/drivers/dri/r128/r128_state.h +++ b/src/mesa/drivers/dri/r128/r128_state.h @@ -38,10 +38,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r128_context.h" extern void r128DDInitState( r128ContextPtr rmesa ); -extern void r128DDInitStateFuncs( GLcontext *ctx ); +extern void r128DDInitStateFuncs( struct gl_context *ctx ); -extern void r128DDUpdateState( GLcontext *ctx ); -extern void r128DDUpdateHWState( GLcontext *ctx ); +extern void r128DDUpdateState( struct gl_context *ctx ); +extern void r128DDUpdateHWState( struct gl_context *ctx ); extern void r128EmitHwStateLocked( r128ContextPtr rmesa ); diff --git a/src/mesa/drivers/dri/r128/r128_tex.c b/src/mesa/drivers/dri/r128/r128_tex.c index b5a19b510a..ba3305e076 100644 --- a/src/mesa/drivers/dri/r128/r128_tex.c +++ b/src/mesa/drivers/dri/r128/r128_tex.c @@ -43,7 +43,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/teximage.h" #include "main/texobj.h" #include "main/imports.h" -#include "main/texobj.h" #include "main/macros.h" #include "xmlpool.h" @@ -174,7 +173,7 @@ static r128TexObjPtr r128AllocTexObj( struct gl_texture_object *texObj ) /* Called by the _mesa_store_teximage[123]d() functions. */ static gl_format -r128ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, +r128ChooseTextureFormat( struct gl_context *ctx, GLint internalFormat, GLenum format, GLenum type ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -288,7 +287,7 @@ r128ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, } -static void r128TexImage1D( GLcontext *ctx, GLenum target, GLint level, +static void r128TexImage1D( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -318,7 +317,7 @@ static void r128TexImage1D( GLcontext *ctx, GLenum target, GLint level, } -static void r128TexSubImage1D( GLcontext *ctx, +static void r128TexSubImage1D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, @@ -351,7 +350,7 @@ static void r128TexSubImage1D( GLcontext *ctx, } -static void r128TexImage2D( GLcontext *ctx, GLenum target, GLint level, +static void r128TexImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -381,7 +380,7 @@ static void r128TexImage2D( GLcontext *ctx, GLenum target, GLint level, } -static void r128TexSubImage2D( GLcontext *ctx, +static void r128TexSubImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -413,7 +412,7 @@ static void r128TexSubImage2D( GLcontext *ctx, } -static void r128TexEnv( GLcontext *ctx, GLenum target, +static void r128TexEnv( struct gl_context *ctx, GLenum target, GLenum pname, const GLfloat *param ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -501,7 +500,7 @@ static void r128TexEnv( GLcontext *ctx, GLenum target, } -static void r128TexParameter( GLcontext *ctx, GLenum target, +static void r128TexParameter( struct gl_context *ctx, GLenum target, struct gl_texture_object *tObj, GLenum pname, const GLfloat *params ) { @@ -552,7 +551,7 @@ static void r128TexParameter( GLcontext *ctx, GLenum target, } } -static void r128BindTexture( GLcontext *ctx, GLenum target, +static void r128BindTexture( struct gl_context *ctx, GLenum target, struct gl_texture_object *tObj ) { if ( R128_DEBUG & DEBUG_VERBOSE_API ) { @@ -565,7 +564,7 @@ static void r128BindTexture( GLcontext *ctx, GLenum target, } -static void r128DeleteTexture( GLcontext *ctx, +static void r128DeleteTexture( struct gl_context *ctx, struct gl_texture_object *tObj ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -589,7 +588,7 @@ static void r128DeleteTexture( GLcontext *ctx, * texture object from the core mesa gl_texture_object. Not done at this time. */ static struct gl_texture_object * -r128NewTextureObject( GLcontext *ctx, GLuint name, GLenum target ) +r128NewTextureObject( struct gl_context *ctx, GLuint name, GLenum target ) { struct gl_texture_object *obj; obj = _mesa_new_texture_object(ctx, name, target); diff --git a/src/mesa/drivers/dri/r128/r128_tex.h b/src/mesa/drivers/dri/r128/r128_tex.h index 7df8decf76..98e9b04ad0 100644 --- a/src/mesa/drivers/dri/r128/r128_tex.h +++ b/src/mesa/drivers/dri/r128/r128_tex.h @@ -35,7 +35,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef __R128_TEX_H__ #define __R128_TEX_H__ -extern void r128UpdateTextureState( GLcontext *ctx ); +extern void r128UpdateTextureState( struct gl_context *ctx ); extern void r128UploadTexImages( r128ContextPtr rmesa, r128TexObjPtr t ); diff --git a/src/mesa/drivers/dri/r128/r128_texstate.c b/src/mesa/drivers/dri/r128/r128_texstate.c index 2505b5cd65..1144163941 100644 --- a/src/mesa/drivers/dri/r128/r128_texstate.c +++ b/src/mesa/drivers/dri/r128/r128_texstate.c @@ -192,7 +192,7 @@ static void r128SetTexImages( r128ContextPtr rmesa, #define INPUT_PREVIOUS (R128_INPUT_FACTOR_PREV_COLOR | \ R128_INP_FACTOR_A_PREV_ALPHA) -static GLboolean r128UpdateTextureEnv( GLcontext *ctx, int unit ) +static GLboolean r128UpdateTextureEnv( struct gl_context *ctx, int unit ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); GLint source = rmesa->tmu_source[unit]; @@ -476,7 +476,7 @@ static GLboolean r128UpdateTextureEnv( GLcontext *ctx, int unit ) return GL_TRUE; } -static void disable_tex( GLcontext *ctx, int unit ) +static void disable_tex( struct gl_context *ctx, int unit ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -499,7 +499,7 @@ static void disable_tex( GLcontext *ctx, int unit ) rmesa->blend_flags &= ~R128_BLEND_MULTITEX; } -static GLboolean enable_tex_2d( GLcontext *ctx, int unit ) +static GLboolean enable_tex_2d( struct gl_context *ctx, int unit ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); const int source = rmesa->tmu_source[unit]; @@ -524,7 +524,7 @@ static GLboolean enable_tex_2d( GLcontext *ctx, int unit ) return GL_TRUE; } -static GLboolean update_tex_common( GLcontext *ctx, int unit ) +static GLboolean update_tex_common( struct gl_context *ctx, int unit ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); const int source = rmesa->tmu_source[unit]; @@ -597,7 +597,7 @@ static GLboolean update_tex_common( GLcontext *ctx, int unit ) return r128UpdateTextureEnv( ctx, unit ); } -static GLboolean updateTextureUnit( GLcontext *ctx, int unit ) +static GLboolean updateTextureUnit( struct gl_context *ctx, int unit ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); const int source = rmesa->tmu_source[unit]; @@ -618,7 +618,7 @@ static GLboolean updateTextureUnit( GLcontext *ctx, int unit ) } -void r128UpdateTextureState( GLcontext *ctx ) +void r128UpdateTextureState( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); GLboolean ok; diff --git a/src/mesa/drivers/dri/r128/r128_tris.c b/src/mesa/drivers/dri/r128/r128_tris.c index 9ea2a9d162..92c8a4eb6b 100644 --- a/src/mesa/drivers/dri/r128/r128_tris.c +++ b/src/mesa/drivers/dri/r128/r128_tris.c @@ -62,8 +62,8 @@ static const GLuint hw_prim[GL_POLYGON+1] = { R128_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST, }; -static void r128RasterPrimitive( GLcontext *ctx, GLuint hwprim ); -static void r128RenderPrimitive( GLcontext *ctx, GLenum prim ); +static void r128RasterPrimitive( struct gl_context *ctx, GLuint hwprim ); +static void r128RenderPrimitive( struct gl_context *ctx, GLenum prim ); /*********************************************************************** @@ -344,7 +344,7 @@ r128_fallback_tri( r128ContextPtr rmesa, r128Vertex *v1, r128Vertex *v2 ) { - GLcontext *ctx = rmesa->glCtx; + struct gl_context *ctx = rmesa->glCtx; SWvertex v[3]; _swsetup_Translate( ctx, v0, &v[0] ); _swsetup_Translate( ctx, v1, &v[1] ); @@ -358,7 +358,7 @@ r128_fallback_line( r128ContextPtr rmesa, r128Vertex *v0, r128Vertex *v1 ) { - GLcontext *ctx = rmesa->glCtx; + struct gl_context *ctx = rmesa->glCtx; SWvertex v[2]; _swsetup_Translate( ctx, v0, &v[0] ); _swsetup_Translate( ctx, v1, &v[1] ); @@ -370,7 +370,7 @@ static void r128_fallback_point( r128ContextPtr rmesa, r128Vertex *v0 ) { - GLcontext *ctx = rmesa->glCtx; + struct gl_context *ctx = rmesa->glCtx; SWvertex v[1]; _swsetup_Translate( ctx, v0, &v[0] ); _swrast_Point( ctx, &v[0] ); @@ -426,7 +426,7 @@ r128_fallback_point( r128ContextPtr rmesa, #define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED) #define _R128_NEW_RENDER_STATE (ANY_FALLBACK_FLAGS | ANY_RASTER_FLAGS) -void r128ChooseRenderState(GLcontext *ctx) +void r128ChooseRenderState(struct gl_context *ctx) { r128ContextPtr rmesa = R128_CONTEXT(ctx); GLuint flags = ctx->_TriangleCaps; @@ -479,7 +479,7 @@ void r128ChooseRenderState(GLcontext *ctx) /* Validate state at pipeline start */ /**********************************************************************/ -static void r128RunPipeline( GLcontext *ctx ) +static void r128RunPipeline( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -509,7 +509,7 @@ static void r128RunPipeline( GLcontext *ctx ) * primitives. */ -static void r128RasterPrimitive( GLcontext *ctx, GLuint hwprim ) +static void r128RasterPrimitive( struct gl_context *ctx, GLuint hwprim ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -531,7 +531,7 @@ static void r128RasterPrimitive( GLcontext *ctx, GLuint hwprim ) } } -static void r128SetupAntialias( GLcontext *ctx, GLenum prim ) +static void r128SetupAntialias( struct gl_context *ctx, GLenum prim ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -553,7 +553,7 @@ static void r128SetupAntialias( GLcontext *ctx, GLenum prim ) } } -static void r128RenderPrimitive( GLcontext *ctx, GLenum prim ) +static void r128RenderPrimitive( struct gl_context *ctx, GLenum prim ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); GLuint hw = hw_prim[prim]; @@ -584,7 +584,7 @@ do { \ offset += (SIZE); \ } while (0) -static void r128RenderStart( GLcontext *ctx ) +static void r128RenderStart( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -681,7 +681,7 @@ static void r128RenderStart( GLcontext *ctx ) } } -static void r128RenderFinish( GLcontext *ctx ) +static void r128RenderFinish( struct gl_context *ctx ) { if (R128_CONTEXT(ctx)->RenderIndex & R128_FALLBACK_BIT) _swrast_flush( ctx ); @@ -717,7 +717,7 @@ static const char *getFallbackString(GLuint bit) return fallbackStrings[i]; } -void r128Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ) +void r128Fallback( struct gl_context *ctx, GLuint bit, GLboolean mode ) { TNLcontext *tnl = TNL_CONTEXT(ctx); r128ContextPtr rmesa = R128_CONTEXT(ctx); @@ -768,7 +768,7 @@ void r128Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ) /* Initialization. */ /**********************************************************************/ -void r128InitTriFuncs( GLcontext *ctx ) +void r128InitTriFuncs( struct gl_context *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/r128/r128_tris.h b/src/mesa/drivers/dri/r128/r128_tris.h index c0667edb61..a139497765 100644 --- a/src/mesa/drivers/dri/r128/r128_tris.h +++ b/src/mesa/drivers/dri/r128/r128_tris.h @@ -37,10 +37,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/mtypes.h" -extern void r128InitTriFuncs( GLcontext *ctx ); -extern void r128ChooseRenderState( GLcontext *ctx ); +extern void r128InitTriFuncs( struct gl_context *ctx ); +extern void r128ChooseRenderState( struct gl_context *ctx ); -extern void r128Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ); +extern void r128Fallback( struct gl_context *ctx, GLuint bit, GLboolean mode ); #define FALLBACK( rmesa, bit, mode ) r128Fallback( rmesa->glCtx, bit, mode ) diff --git a/src/mesa/drivers/dri/r200/r200_blit.c b/src/mesa/drivers/dri/r200/r200_blit.c index e187fc0f61..05a15c444c 100644 --- a/src/mesa/drivers/dri/r200/r200_blit.c +++ b/src/mesa/drivers/dri/r200/r200_blit.c @@ -444,7 +444,7 @@ static inline void emit_draw_packet(struct r200_context *r200, * @param[in] height region height * @param[in] flip_y set if y coords of the source image need to be flipped */ -unsigned r200_blit(GLcontext *ctx, +unsigned r200_blit(struct gl_context *ctx, struct radeon_bo *src_bo, intptr_t src_offset, gl_format src_mesaformat, diff --git a/src/mesa/drivers/dri/r200/r200_blit.h b/src/mesa/drivers/dri/r200/r200_blit.h index 53206f0b47..56018b9c0e 100644 --- a/src/mesa/drivers/dri/r200/r200_blit.h +++ b/src/mesa/drivers/dri/r200/r200_blit.h @@ -32,7 +32,7 @@ void r200_blit_init(struct r200_context *r200); unsigned r200_check_blit(gl_format mesa_format); -unsigned r200_blit(GLcontext *ctx, +unsigned r200_blit(struct gl_context *ctx, struct radeon_bo *src_bo, intptr_t src_offset, gl_format src_mesaformat, diff --git a/src/mesa/drivers/dri/r200/r200_cmdbuf.c b/src/mesa/drivers/dri/r200/r200_cmdbuf.c index ad43a8ca92..931a9ecf8f 100644 --- a/src/mesa/drivers/dri/r200/r200_cmdbuf.c +++ b/src/mesa/drivers/dri/r200/r200_cmdbuf.c @@ -167,7 +167,7 @@ static void r200FireEB(r200ContextPtr rmesa, int vertex_count, int type) } } -void r200FlushElts(GLcontext *ctx) +void r200FlushElts(struct gl_context *ctx) { r200ContextPtr rmesa = R200_CONTEXT(ctx); int nr, elt_used = rmesa->tcl.elt_used; diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index 5896296021..723e31401d 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -80,7 +80,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* Return various strings for glGetString(). */ -static const GLubyte *r200GetString( GLcontext *ctx, GLenum name ) +static const GLubyte *r200GetString( struct gl_context *ctx, GLenum name ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); static char buffer[128]; @@ -137,7 +137,6 @@ static const struct dri_extension card_extensions[] = { "GL_ATI_texture_mirror_once", NULL }, { "GL_MESA_pack_invert", NULL }, { "GL_NV_blend_square", NULL }, - { "GL_SGIS_generate_mipmap", NULL }, { NULL, NULL } }; @@ -272,7 +271,7 @@ static void r200_init_vtbl(radeonContextPtr radeon) /* Create the device specific rendering context. */ GLboolean r200CreateContext( gl_api api, - const __GLcontextModes *glVisual, + const struct gl_config *glVisual, __DRIcontext *driContextPriv, void *sharedContextPrivate) { @@ -280,7 +279,7 @@ GLboolean r200CreateContext( gl_api api, radeonScreenPtr screen = (radeonScreenPtr)(sPriv->private); struct dd_function_table functions; r200ContextPtr rmesa; - GLcontext *ctx; + struct gl_context *ctx; int i; int tcl_mode; diff --git a/src/mesa/drivers/dri/r200/r200_context.h b/src/mesa/drivers/dri/r200/r200_context.h index 305958f5d7..657902fcaa 100644 --- a/src/mesa/drivers/dri/r200/r200_context.h +++ b/src/mesa/drivers/dri/r200/r200_context.h @@ -638,7 +638,7 @@ struct r200_context { extern void r200DestroyContext( __DRIcontext *driContextPriv ); extern GLboolean r200CreateContext( gl_api api, - const __GLcontextModes *glVisual, + const struct gl_config *glVisual, __DRIcontext *driContextPriv, void *sharedContextPrivate); extern GLboolean r200MakeCurrent( __DRIcontext *driContextPriv, diff --git a/src/mesa/drivers/dri/r200/r200_fragshader.c b/src/mesa/drivers/dri/r200/r200_fragshader.c index 2a9268dd34..b1d045c5ca 100644 --- a/src/mesa/drivers/dri/r200/r200_fragshader.c +++ b/src/mesa/drivers/dri/r200/r200_fragshader.c @@ -121,7 +121,7 @@ static GLuint dstmask_table[8] = R200_TXC_OUTPUT_MASK_RGB }; -static void r200UpdateFSArith( GLcontext *ctx ) +static void r200UpdateFSArith( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint *afs_cmd; @@ -322,7 +322,7 @@ static void r200UpdateFSArith( GLcontext *ctx ) rmesa->afs_loaded = ctx->ATIFragmentShader.Current; } -static void r200UpdateFSRouting( GLcontext *ctx ) { +static void r200UpdateFSRouting( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); const struct ati_fragment_shader *shader = ctx->ATIFragmentShader.Current; GLuint reg; @@ -499,7 +499,7 @@ static void r200UpdateFSRouting( GLcontext *ctx ) { } } -static void r200UpdateFSConstants( GLcontext *ctx ) +static void r200UpdateFSConstants( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); const struct ati_fragment_shader *shader = ctx->ATIFragmentShader.Current; @@ -537,7 +537,7 @@ static void r200UpdateFSConstants( GLcontext *ctx ) * stored in some DriverData object attached to the mesa atifs object, i.e. binding a * shader wouldn't force us to "recompile" the shader). */ -void r200UpdateFragmentShader( GLcontext *ctx ) +void r200UpdateFragmentShader( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c b/src/mesa/drivers/dri/r200/r200_ioctl.c index df73de5394..02201cb53d 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.c +++ b/src/mesa/drivers/dri/r200/r200_ioctl.c @@ -54,7 +54,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define R200_TIMEOUT 512 #define R200_IDLE_RETRY 16 -static void r200KernelClear(GLcontext *ctx, GLuint flags) +static void r200KernelClear(struct gl_context *ctx, GLuint flags) { r200ContextPtr rmesa = R200_CONTEXT(ctx); __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon); @@ -180,7 +180,7 @@ static void r200KernelClear(GLcontext *ctx, GLuint flags) /* ================================================================ * Buffer clear */ -static void r200Clear( GLcontext *ctx, GLbitfield mask ) +static void r200Clear( struct gl_context *ctx, GLbitfield mask ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon); diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.h b/src/mesa/drivers/dri/r200/r200_ioctl.h index c5dca89bc7..f2527189aa 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.h +++ b/src/mesa/drivers/dri/r200/r200_ioctl.h @@ -54,7 +54,7 @@ extern void r200EmitVbufPrim( r200ContextPtr rmesa, GLuint primitive, GLuint vertex_nr ); -extern void r200FlushElts(GLcontext *ctx); +extern void r200FlushElts(struct gl_context *ctx); extern GLushort *r200AllocEltsOpenEnded( r200ContextPtr rmesa, GLuint primitive, diff --git a/src/mesa/drivers/dri/r200/r200_maos.h b/src/mesa/drivers/dri/r200/r200_maos.h index 16a70475e1..f58f77d8db 100644 --- a/src/mesa/drivers/dri/r200/r200_maos.h +++ b/src/mesa/drivers/dri/r200/r200_maos.h @@ -37,6 +37,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r200_context.h" -extern void r200EmitArrays( GLcontext *ctx, GLubyte *vimap_rev ); +extern void r200EmitArrays( struct gl_context *ctx, GLubyte *vimap_rev ); #endif diff --git a/src/mesa/drivers/dri/r200/r200_maos_arrays.c b/src/mesa/drivers/dri/r200/r200_maos_arrays.c index aecba7f894..8a047e6419 100644 --- a/src/mesa/drivers/dri/r200/r200_maos_arrays.c +++ b/src/mesa/drivers/dri/r200/r200_maos_arrays.c @@ -70,7 +70,7 @@ do { \ } while (0) #endif -static void r200_emit_vecfog(GLcontext *ctx, struct radeon_aos *aos, +static void r200_emit_vecfog(struct gl_context *ctx, struct radeon_aos *aos, GLvoid *data, int stride, int count) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); @@ -103,7 +103,7 @@ static void r200_emit_vecfog(GLcontext *ctx, struct radeon_aos *aos, /* Emit any changed arrays to new GART memory, re-emit a packet to * update the arrays. */ -void r200EmitArrays( GLcontext *ctx, GLubyte *vimap_rev ) +void r200EmitArrays( struct gl_context *ctx, GLubyte *vimap_rev ) { r200ContextPtr rmesa = R200_CONTEXT( ctx ); struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb; diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index 29d7bed8b6..b523edcb5d 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -63,7 +63,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Alpha blending */ -static void r200AlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) +static void r200AlphaFunc( struct gl_context *ctx, GLenum func, GLfloat ref ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); int pp_misc = rmesa->hw.ctx.cmd[CTX_PP_MISC]; @@ -106,7 +106,7 @@ static void r200AlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) rmesa->hw.ctx.cmd[CTX_PP_MISC] = pp_misc; } -static void r200BlendColor( GLcontext *ctx, const GLfloat cf[4] ) +static void r200BlendColor( struct gl_context *ctx, const GLfloat cf[4] ) { GLubyte color[4]; r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -199,7 +199,7 @@ static int blend_factor( GLenum factor, GLboolean is_src ) * and GL_FUNC_REVERSE_SUBTRACT will cause wrong results otherwise for * unknown reasons. */ -static void r200_set_blend_state( GLcontext * ctx ) +static void r200_set_blend_state( struct gl_context * ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint cntl = rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] & @@ -323,13 +323,13 @@ static void r200_set_blend_state( GLcontext * ctx ) } -static void r200BlendEquationSeparate( GLcontext *ctx, +static void r200BlendEquationSeparate( struct gl_context *ctx, GLenum modeRGB, GLenum modeA ) { r200_set_blend_state( ctx ); } -static void r200BlendFuncSeparate( GLcontext *ctx, +static void r200BlendFuncSeparate( struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) { @@ -341,7 +341,7 @@ static void r200BlendFuncSeparate( GLcontext *ctx, * Depth testing */ -static void r200DepthFunc( GLcontext *ctx, GLenum func ) +static void r200DepthFunc( struct gl_context *ctx, GLenum func ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -376,7 +376,7 @@ static void r200DepthFunc( GLcontext *ctx, GLenum func ) } } -static void r200ClearDepth( GLcontext *ctx, GLclampd d ) +static void r200ClearDepth( struct gl_context *ctx, GLclampd d ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint format = (rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] & @@ -392,7 +392,7 @@ static void r200ClearDepth( GLcontext *ctx, GLclampd d ) } } -static void r200DepthMask( GLcontext *ctx, GLboolean flag ) +static void r200DepthMask( struct gl_context *ctx, GLboolean flag ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); R200_STATECHANGE( rmesa, ctx ); @@ -410,7 +410,7 @@ static void r200DepthMask( GLcontext *ctx, GLboolean flag ) */ -static void r200Fogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) +static void r200Fogfv( struct gl_context *ctx, GLenum pname, const GLfloat *param ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); union { int i; float f; } c, d; @@ -526,7 +526,7 @@ static void r200Fogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) * Culling */ -static void r200CullFace( GLcontext *ctx, GLenum unused ) +static void r200CullFace( struct gl_context *ctx, GLenum unused ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint s = rmesa->hw.set.cmd[SET_SE_CNTL]; @@ -563,7 +563,7 @@ static void r200CullFace( GLcontext *ctx, GLenum unused ) } } -static void r200FrontFace( GLcontext *ctx, GLenum mode ) +static void r200FrontFace( struct gl_context *ctx, GLenum mode ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -591,7 +591,7 @@ static void r200FrontFace( GLcontext *ctx, GLenum mode ) /* ============================================================= * Point state */ -static void r200PointSize( GLcontext *ctx, GLfloat size ) +static void r200PointSize( struct gl_context *ctx, GLfloat size ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLfloat *fcmd = (GLfloat *)rmesa->hw.ptp.cmd; @@ -612,7 +612,7 @@ static void r200PointSize( GLcontext *ctx, GLfloat size ) fcmd[PTP_VPORT_SCALE_PTSIZE] = ctx->Point.Size; } -static void r200PointParameter( GLcontext *ctx, GLenum pname, const GLfloat *params) +static void r200PointParameter( struct gl_context *ctx, GLenum pname, const GLfloat *params) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLfloat *fcmd = (GLfloat *)rmesa->hw.ptp.cmd; @@ -680,7 +680,7 @@ static void r200PointParameter( GLcontext *ctx, GLenum pname, const GLfloat *par /* ============================================================= * Line state */ -static void r200LineWidth( GLcontext *ctx, GLfloat widthf ) +static void r200LineWidth( struct gl_context *ctx, GLfloat widthf ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -701,7 +701,7 @@ static void r200LineWidth( GLcontext *ctx, GLfloat widthf ) } } -static void r200LineStipple( GLcontext *ctx, GLint factor, GLushort pattern ) +static void r200LineStipple( struct gl_context *ctx, GLint factor, GLushort pattern ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -714,7 +714,7 @@ static void r200LineStipple( GLcontext *ctx, GLint factor, GLushort pattern ) /* ============================================================= * Masks */ -static void r200ColorMask( GLcontext *ctx, +static void r200ColorMask( struct gl_context *ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) { @@ -752,7 +752,7 @@ static void r200ColorMask( GLcontext *ctx, * Polygon state */ -static void r200PolygonOffset( GLcontext *ctx, +static void r200PolygonOffset( struct gl_context *ctx, GLfloat factor, GLfloat units ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -770,7 +770,7 @@ static void r200PolygonOffset( GLcontext *ctx, rmesa->hw.zbs.cmd[ZBS_SE_ZBIAS_CONSTANT] = constant.ui32; } -static void r200PolygonMode( GLcontext *ctx, GLenum face, GLenum mode ) +static void r200PolygonMode( struct gl_context *ctx, GLenum face, GLenum mode ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLboolean flag = (ctx->_TriangleCaps & DD_TRI_UNFILLED) != 0; @@ -797,7 +797,7 @@ static void r200PolygonMode( GLcontext *ctx, GLenum face, GLenum mode ) /* Examine lighting and texture state to determine if separate specular * should be enabled. */ -static void r200UpdateSpecular( GLcontext *ctx ) +static void r200UpdateSpecular( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); uint32_t p = rmesa->hw.ctx.cmd[CTX_PP_CNTL]; @@ -871,7 +871,7 @@ static void r200UpdateSpecular( GLcontext *ctx ) /* Update on colormaterial, material emmissive/ambient, * lightmodel.globalambient */ -static void update_global_ambient( GLcontext *ctx ) +static void update_global_ambient( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); float *fcmd = (float *)R200_DB_STATE( glt ); @@ -902,7 +902,7 @@ static void update_global_ambient( GLcontext *ctx ) * - light[p].colors * - light[p].enabled */ -static void update_light_colors( GLcontext *ctx, GLuint p ) +static void update_light_colors( struct gl_context *ctx, GLuint p ) { struct gl_light *l = &ctx->Light.Light[p]; @@ -920,7 +920,7 @@ static void update_light_colors( GLcontext *ctx, GLuint p ) } } -static void r200ColorMaterial( GLcontext *ctx, GLenum face, GLenum mode ) +static void r200ColorMaterial( struct gl_context *ctx, GLenum face, GLenum mode ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint light_model_ctl1 = rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_1]; @@ -1022,7 +1022,7 @@ static void r200ColorMaterial( GLcontext *ctx, GLenum face, GLenum mode ) } -void r200UpdateMaterial( GLcontext *ctx ) +void r200UpdateMaterial( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLfloat (*mat)[4] = ctx->Light.Material.Attrib; @@ -1117,7 +1117,7 @@ void r200UpdateMaterial( GLcontext *ctx ) * lighting space (model or eye), hence dependencies on _NEW_MODELVIEW * and _MESA_NEW_NEED_EYE_COORDS. */ -static void update_light( GLcontext *ctx ) +static void update_light( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -1177,7 +1177,7 @@ static void update_light( GLcontext *ctx ) } } -static void r200Lightfv( GLcontext *ctx, GLenum light, +static void r200Lightfv( struct gl_context *ctx, GLenum light, GLenum pname, const GLfloat *params ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -1288,7 +1288,7 @@ static void r200Lightfv( GLcontext *ctx, GLenum light, } } -static void r200UpdateLocalViewer ( GLcontext *ctx ) +static void r200UpdateLocalViewer ( struct gl_context *ctx ) { /* It looks like for the texgen modes GL_SPHERE_MAP, GL_NORMAL_MAP and GL_REFLECTION_MAP we need R200_LOCAL_VIEWER set (fglrx does exactly that @@ -1308,7 +1308,7 @@ static void r200UpdateLocalViewer ( GLcontext *ctx ) rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= ~R200_LOCAL_VIEWER; } -static void r200LightModelfv( GLcontext *ctx, GLenum pname, +static void r200LightModelfv( struct gl_context *ctx, GLenum pname, const GLfloat *param ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -1343,7 +1343,7 @@ static void r200LightModelfv( GLcontext *ctx, GLenum pname, } } -static void r200ShadeModel( GLcontext *ctx, GLenum mode ) +static void r200ShadeModel( struct gl_context *ctx, GLenum mode ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint s = rmesa->hw.set.cmd[SET_SE_CNTL]; @@ -1384,7 +1384,7 @@ static void r200ShadeModel( GLcontext *ctx, GLenum mode ) * User clip planes */ -static void r200ClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq ) +static void r200ClipPlane( struct gl_context *ctx, GLenum plane, const GLfloat *eq ) { GLint p = (GLint) plane - (GLint) GL_CLIP_PLANE0; r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -1397,7 +1397,7 @@ static void r200ClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq ) rmesa->hw.ucp[p].cmd[UCP_W] = ip[3]; } -static void r200UpdateClipPlanes( GLcontext *ctx ) +static void r200UpdateClipPlanes( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint p; @@ -1421,7 +1421,7 @@ static void r200UpdateClipPlanes( GLcontext *ctx ) */ static void -r200StencilFuncSeparate( GLcontext *ctx, GLenum face, GLenum func, +r200StencilFuncSeparate( struct gl_context *ctx, GLenum face, GLenum func, GLint ref, GLuint mask ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -1466,7 +1466,7 @@ r200StencilFuncSeparate( GLcontext *ctx, GLenum face, GLenum func, } static void -r200StencilMaskSeparate( GLcontext *ctx, GLenum face, GLuint mask ) +r200StencilMaskSeparate( struct gl_context *ctx, GLenum face, GLuint mask ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -1477,7 +1477,7 @@ r200StencilMaskSeparate( GLcontext *ctx, GLenum face, GLuint mask ) } static void -r200StencilOpSeparate( GLcontext *ctx, GLenum face, GLenum fail, +r200StencilOpSeparate( struct gl_context *ctx, GLenum face, GLenum fail, GLenum zfail, GLenum zpass ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -1569,7 +1569,7 @@ r200StencilOpSeparate( GLcontext *ctx, GLenum face, GLenum fail, } } -static void r200ClearStencil( GLcontext *ctx, GLint s ) +static void r200ClearStencil( struct gl_context *ctx, GLint s ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -1588,7 +1588,7 @@ static void r200ClearStencil( GLcontext *ctx, GLint s ) * Called when window size or position changes or viewport or depth range * state is changed. We update the hardware viewport state here. */ -void r200UpdateWindow( GLcontext *ctx ) +void r200UpdateWindow( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon); @@ -1624,7 +1624,7 @@ void r200UpdateWindow( GLcontext *ctx ) rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZOFFSET] = tz.ui32; } -void r200_vtbl_update_scissor( GLcontext *ctx ) +void r200_vtbl_update_scissor( struct gl_context *ctx ) { r200ContextPtr r200 = R200_CONTEXT(ctx); unsigned x1, y1, x2, y2; @@ -1650,7 +1650,7 @@ void r200_vtbl_update_scissor( GLcontext *ctx ) } -static void r200Viewport( GLcontext *ctx, GLint x, GLint y, +static void r200Viewport( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) { /* Don't pipeline viewport changes, conflict with window offset @@ -1662,13 +1662,13 @@ static void r200Viewport( GLcontext *ctx, GLint x, GLint y, radeon_viewport(ctx, x, y, width, height); } -static void r200DepthRange( GLcontext *ctx, GLclampd nearval, +static void r200DepthRange( struct gl_context *ctx, GLclampd nearval, GLclampd farval ) { r200UpdateWindow( ctx ); } -void r200UpdateViewportOffset( GLcontext *ctx ) +void r200UpdateViewportOffset( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon); @@ -1724,7 +1724,7 @@ void r200UpdateViewportOffset( GLcontext *ctx ) * Miscellaneous */ -static void r200ClearColor( GLcontext *ctx, const GLfloat c[4] ) +static void r200ClearColor( struct gl_context *ctx, const GLfloat c[4] ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLubyte color[4]; @@ -1743,7 +1743,7 @@ static void r200ClearColor( GLcontext *ctx, const GLfloat c[4] ) } -static void r200RenderMode( GLcontext *ctx, GLenum mode ) +static void r200RenderMode( struct gl_context *ctx, GLenum mode ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); FALLBACK( rmesa, R200_FALLBACK_RENDER_MODE, (mode != GL_RENDER) ); @@ -1769,7 +1769,7 @@ static GLuint r200_rop_tab[] = { R200_ROP_SET, }; -static void r200LogicOpCode( GLcontext *ctx, GLenum opcode ) +static void r200LogicOpCode( struct gl_context *ctx, GLenum opcode ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint rop = (GLuint)opcode - GL_CLEAR; @@ -1784,7 +1784,7 @@ static void r200LogicOpCode( GLcontext *ctx, GLenum opcode ) * State enable/disable */ -static void r200Enable( GLcontext *ctx, GLenum cap, GLboolean state ) +static void r200Enable( struct gl_context *ctx, GLenum cap, GLboolean state ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint p, flag; @@ -2168,7 +2168,7 @@ static void r200Enable( GLcontext *ctx, GLenum cap, GLboolean state ) } -void r200LightingSpaceChange( GLcontext *ctx ) +void r200LightingSpaceChange( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLboolean tmp; @@ -2225,7 +2225,7 @@ static void upload_matrix_t( r200ContextPtr rmesa, const GLfloat *src, int idx ) } -static void update_texturematrix( GLcontext *ctx ) +static void update_texturematrix( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT( ctx ); GLuint tpc = rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_0]; @@ -2283,7 +2283,7 @@ static void update_texturematrix( GLcontext *ctx ) } } -static GLboolean r200ValidateBuffers(GLcontext *ctx) +static GLboolean r200ValidateBuffers(struct gl_context *ctx) { r200ContextPtr rmesa = R200_CONTEXT(ctx); struct radeon_renderbuffer *rrb; @@ -2333,7 +2333,7 @@ static GLboolean r200ValidateBuffers(GLcontext *ctx) return GL_TRUE; } -GLboolean r200ValidateState( GLcontext *ctx ) +GLboolean r200ValidateState( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint new_state = rmesa->radeon.NewGLState; @@ -2405,7 +2405,7 @@ GLboolean r200ValidateState( GLcontext *ctx ) } -static void r200InvalidateState( GLcontext *ctx, GLuint new_state ) +static void r200InvalidateState( struct gl_context *ctx, GLuint new_state ) { _swrast_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); @@ -2420,7 +2420,7 @@ static void r200InvalidateState( GLcontext *ctx, GLuint new_state ) * Should map to inputs just like the generic vertex arrays for vertex progs. * In theory there could still be too many and we'd still need a fallback. */ -static GLboolean check_material( GLcontext *ctx ) +static GLboolean check_material( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLint i; @@ -2435,7 +2435,7 @@ static GLboolean check_material( GLcontext *ctx ) return GL_FALSE; } -static void r200WrapRunPipeline( GLcontext *ctx ) +static void r200WrapRunPipeline( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLboolean has_material; @@ -2465,7 +2465,7 @@ static void r200WrapRunPipeline( GLcontext *ctx ) } -static void r200PolygonStipple( GLcontext *ctx, const GLubyte *mask ) +static void r200PolygonStipple( struct gl_context *ctx, const GLubyte *mask ) { r200ContextPtr r200 = R200_CONTEXT(ctx); GLint i; @@ -2538,7 +2538,7 @@ void r200InitStateFuncs( radeonContextPtr radeon, struct dd_function_table *func } -void r200InitTnlFuncs( GLcontext *ctx ) +void r200InitTnlFuncs( struct gl_context *ctx ) { TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange = r200UpdateMaterial; TNL_CONTEXT(ctx)->Driver.RunPipeline = r200WrapRunPipeline; diff --git a/src/mesa/drivers/dri/r200/r200_state.h b/src/mesa/drivers/dri/r200/r200_state.h index 327ba837e2..340bd8234a 100644 --- a/src/mesa/drivers/dri/r200/r200_state.h +++ b/src/mesa/drivers/dri/r200/r200_state.h @@ -39,25 +39,25 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. extern void r200InitState( r200ContextPtr rmesa ); extern void r200InitStateFuncs( radeonContextPtr radeon, struct dd_function_table *functions ); -extern void r200InitTnlFuncs( GLcontext *ctx ); +extern void r200InitTnlFuncs( struct gl_context *ctx ); -extern void r200UpdateMaterial( GLcontext *ctx ); +extern void r200UpdateMaterial( struct gl_context *ctx ); -extern void r200UpdateViewportOffset( GLcontext *ctx ); -extern void r200UpdateWindow( GLcontext *ctx ); -extern void r200UpdateDrawBuffer(GLcontext *ctx); +extern void r200UpdateViewportOffset( struct gl_context *ctx ); +extern void r200UpdateWindow( struct gl_context *ctx ); +extern void r200UpdateDrawBuffer(struct gl_context *ctx); -extern GLboolean r200ValidateState( GLcontext *ctx ); +extern GLboolean r200ValidateState( struct gl_context *ctx ); -extern void r200_vtbl_update_scissor( GLcontext *ctx ); +extern void r200_vtbl_update_scissor( struct gl_context *ctx ); -extern void r200Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ); +extern void r200Fallback( struct gl_context *ctx, GLuint bit, GLboolean mode ); #define FALLBACK( rmesa, bit, mode ) do { \ if ( 0 ) fprintf( stderr, "FALLBACK in %s: #%d=%d\n", \ __FUNCTION__, bit, mode ); \ r200Fallback( rmesa->radeon.glCtx, bit, mode ); \ } while (0) -extern void r200LightingSpaceChange( GLcontext *ctx ); +extern void r200LightingSpaceChange( struct gl_context *ctx ); #endif diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c index 1606553009..f6afb90d59 100644 --- a/src/mesa/drivers/dri/r200/r200_state_init.c +++ b/src/mesa/drivers/dri/r200/r200_state_init.c @@ -228,7 +228,7 @@ static int cmdscl2( int offset, int stride, int count ) * If it is active check function returns maximum emit size. */ #define CHECK( NM, FLAG, ADD ) \ -static int check_##NM( GLcontext *ctx, struct radeon_state_atom *atom) \ +static int check_##NM( struct gl_context *ctx, struct radeon_state_atom *atom) \ { \ r200ContextPtr rmesa = R200_CONTEXT(ctx); \ (void) rmesa; \ @@ -236,21 +236,21 @@ static int check_##NM( GLcontext *ctx, struct radeon_state_atom *atom) \ } #define TCL_CHECK( NM, FLAG, ADD ) \ -static int check_##NM( GLcontext *ctx, struct radeon_state_atom *atom) \ +static int check_##NM( struct gl_context *ctx, struct radeon_state_atom *atom) \ { \ r200ContextPtr rmesa = R200_CONTEXT(ctx); \ return (!rmesa->radeon.TclFallback && !ctx->VertexProgram._Enabled && (FLAG)) ? atom->cmd_size + (ADD) : 0; \ } #define TCL_OR_VP_CHECK( NM, FLAG, ADD ) \ -static int check_##NM( GLcontext *ctx, struct radeon_state_atom *atom ) \ +static int check_##NM( struct gl_context *ctx, struct radeon_state_atom *atom ) \ { \ r200ContextPtr rmesa = R200_CONTEXT(ctx); \ return (!rmesa->radeon.TclFallback && (FLAG)) ? atom->cmd_size + (ADD) : 0; \ } #define VP_CHECK( NM, FLAG, ADD ) \ -static int check_##NM( GLcontext *ctx, struct radeon_state_atom *atom ) \ +static int check_##NM( struct gl_context *ctx, struct radeon_state_atom *atom ) \ { \ r200ContextPtr rmesa = R200_CONTEXT(ctx); \ (void) atom; \ @@ -337,7 +337,7 @@ VP_CHECK( tcl_vpp_size_add4, ctx->VertexProgram.Current->Base.NumNativeParameter OUT_BATCH(CP_PACKET0_ONE(R200_SE_TCL_SCALAR_DATA_REG, h.scalars.count - 1)); \ OUT_BATCH_TABLE((data), h.scalars.count); \ } while(0) -static int check_rrb(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_rrb(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); struct radeon_renderbuffer *rrb; @@ -347,7 +347,7 @@ static int check_rrb(GLcontext *ctx, struct radeon_state_atom *atom) return atom->cmd_size; } -static int check_polygon_stipple(GLcontext *ctx, +static int check_polygon_stipple(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); @@ -356,7 +356,7 @@ static int check_polygon_stipple(GLcontext *ctx, return 0; } -static void mtl_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void mtl_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); BATCH_LOCALS(&r200->radeon); @@ -368,7 +368,7 @@ static void mtl_emit(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static void lit_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void lit_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); BATCH_LOCALS(&r200->radeon); @@ -380,7 +380,7 @@ static void lit_emit(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static void ptp_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void ptp_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); BATCH_LOCALS(&r200->radeon); @@ -392,7 +392,7 @@ static void ptp_emit(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static void veclinear_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void veclinear_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); BATCH_LOCALS(&r200->radeon); @@ -401,7 +401,7 @@ static void veclinear_emit(GLcontext *ctx, struct radeon_state_atom *atom) OUT_VECLINEAR(atom->cmd[0], atom->cmd+1); } -static void scl_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void scl_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); BATCH_LOCALS(&r200->radeon); @@ -413,7 +413,7 @@ static void scl_emit(GLcontext *ctx, struct radeon_state_atom *atom) } -static void vec_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void vec_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); BATCH_LOCALS(&r200->radeon); @@ -424,7 +424,7 @@ static void vec_emit(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static void ctx_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void ctx_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); BATCH_LOCALS(&r200->radeon); @@ -491,7 +491,7 @@ static void ctx_emit(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static int check_always_ctx( GLcontext *ctx, struct radeon_state_atom *atom) +static int check_always_ctx( struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); struct radeon_renderbuffer *rrb, *drb; @@ -516,7 +516,7 @@ static int check_always_ctx( GLcontext *ctx, struct radeon_state_atom *atom) return dwords; } -static void ctx_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) +static void ctx_emit_cs(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); BATCH_LOCALS(&r200->radeon); @@ -600,7 +600,7 @@ static void ctx_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static int get_tex_size(GLcontext* ctx, struct radeon_state_atom *atom) +static int get_tex_size(struct gl_context* ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); uint32_t dwords = atom->cmd_size + 2; @@ -612,7 +612,7 @@ static int get_tex_size(GLcontext* ctx, struct radeon_state_atom *atom) return dwords; } -static int check_tex_pair(GLcontext* ctx, struct radeon_state_atom *atom) +static int check_tex_pair(struct gl_context* ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); /** XOR is bit flip operation so use it for finding pair */ @@ -622,7 +622,7 @@ static int check_tex_pair(GLcontext* ctx, struct radeon_state_atom *atom) return get_tex_size(ctx, atom); } -static int check_tex(GLcontext* ctx, struct radeon_state_atom *atom) +static int check_tex(struct gl_context* ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); if (!(r200->state.texture.unit[atom->idx].unitneeded)) @@ -632,7 +632,7 @@ static int check_tex(GLcontext* ctx, struct radeon_state_atom *atom) } -static void tex_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void tex_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); BATCH_LOCALS(&r200->radeon); @@ -657,7 +657,7 @@ static void tex_emit(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static int get_tex_mm_size(GLcontext* ctx, struct radeon_state_atom *atom) +static int get_tex_mm_size(struct gl_context* ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); uint32_t dwords = atom->cmd_size + 2; @@ -676,7 +676,7 @@ static int get_tex_mm_size(GLcontext* ctx, struct radeon_state_atom *atom) return dwords; } -static int check_tex_pair_mm(GLcontext* ctx, struct radeon_state_atom *atom) +static int check_tex_pair_mm(struct gl_context* ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); /** XOR is bit flip operation so use it for finding pair */ @@ -686,7 +686,7 @@ static int check_tex_pair_mm(GLcontext* ctx, struct radeon_state_atom *atom) return get_tex_mm_size(ctx, atom); } -static int check_tex_mm(GLcontext* ctx, struct radeon_state_atom *atom) +static int check_tex_mm(struct gl_context* ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); if (!(r200->state.texture.unit[atom->idx].unitneeded)) @@ -696,7 +696,7 @@ static int check_tex_mm(GLcontext* ctx, struct radeon_state_atom *atom) } -static void tex_emit_mm(GLcontext *ctx, struct radeon_state_atom *atom) +static void tex_emit_mm(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); BATCH_LOCALS(&r200->radeon); @@ -726,7 +726,7 @@ static void tex_emit_mm(GLcontext *ctx, struct radeon_state_atom *atom) } -static void cube_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void cube_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); BATCH_LOCALS(&r200->radeon); @@ -753,7 +753,7 @@ static void cube_emit(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static void cube_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) +static void cube_emit_cs(struct gl_context *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); BATCH_LOCALS(&r200->radeon); @@ -782,7 +782,7 @@ static void cube_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) */ void r200InitState( r200ContextPtr rmesa ) { - GLcontext *ctx = rmesa->radeon.glCtx; + struct gl_context *ctx = rmesa->radeon.glCtx; GLuint i; rmesa->radeon.state.color.clear = 0x00000000; diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c index dbf4ad477d..38864162ce 100644 --- a/src/mesa/drivers/dri/r200/r200_swtcl.c +++ b/src/mesa/drivers/dri/r200/r200_swtcl.c @@ -75,7 +75,7 @@ do { \ rmesa->radeon.swtcl.vertex_attr_count++; \ } while (0) -static void r200SetVertexFormat( GLcontext *ctx ) +static void r200SetVertexFormat( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -221,7 +221,7 @@ static void r200_predict_emit_size( r200ContextPtr rmesa ) } -static void r200RenderStart( GLcontext *ctx ) +static void r200RenderStart( struct gl_context *ctx ) { r200SetVertexFormat( ctx ); if (RADEON_DEBUG & RADEON_VERTS) @@ -234,7 +234,7 @@ static void r200RenderStart( GLcontext *ctx ) * determine in advance whether or not the hardware can / should do the * projection divide or Mesa should do it. */ -void r200ChooseVertexState( GLcontext *ctx ) +void r200ChooseVertexState( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -286,7 +286,7 @@ void r200ChooseVertexState( GLcontext *ctx ) } } -void r200_swtcl_flush(GLcontext *ctx, uint32_t current_offset) +void r200_swtcl_flush(struct gl_context *ctx, uint32_t current_offset) { r200ContextPtr rmesa = R200_CONTEXT(ctx); if (RADEON_DEBUG & RADEON_VERTS) @@ -315,7 +315,7 @@ void r200_swtcl_flush(GLcontext *ctx, uint32_t current_offset) /**************************************************************************/ -static INLINE GLuint reduced_hw_prim( GLcontext *ctx, GLuint prim) +static INLINE GLuint reduced_hw_prim( struct gl_context *ctx, GLuint prim) { switch (prim) { case GL_POINTS: @@ -336,9 +336,9 @@ static INLINE GLuint reduced_hw_prim( GLcontext *ctx, GLuint prim) } -static void r200RasterPrimitive( GLcontext *ctx, GLuint hwprim ); -static void r200RenderPrimitive( GLcontext *ctx, GLenum prim ); -static void r200ResetLineStipple( GLcontext *ctx ); +static void r200RasterPrimitive( struct gl_context *ctx, GLuint hwprim ); +static void r200RenderPrimitive( struct gl_context *ctx, GLenum prim ); +static void r200ResetLineStipple( struct gl_context *ctx ); /*********************************************************************** * Emit primitives as inline vertices * @@ -568,7 +568,7 @@ static void init_rast_tab( void ) /* Choose render functions */ /**********************************************************************/ -void r200ChooseRenderState( GLcontext *ctx ) +void r200ChooseRenderState( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -608,11 +608,14 @@ void r200ChooseRenderState( GLcontext *ctx ) /**********************************************************************/ -static void r200RasterPrimitive( GLcontext *ctx, GLuint hwprim ) +static void r200RasterPrimitive( struct gl_context *ctx, GLuint hwprim ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); radeon_prepare_render(&rmesa->radeon); + if (rmesa->radeon.NewGLState) + r200ValidateState( ctx ); + if (rmesa->radeon.swtcl.hw_primitive != hwprim) { /* need to disable perspective-correct texturing for point sprites */ @@ -631,7 +634,7 @@ static void r200RasterPrimitive( GLcontext *ctx, GLuint hwprim ) } } -static void r200RenderPrimitive( GLcontext *ctx, GLenum prim ) +static void r200RenderPrimitive( struct gl_context *ctx, GLenum prim ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); rmesa->radeon.swtcl.render_primitive = prim; @@ -639,11 +642,11 @@ static void r200RenderPrimitive( GLcontext *ctx, GLenum prim ) r200RasterPrimitive( ctx, reduced_hw_prim(ctx, prim) ); } -static void r200RenderFinish( GLcontext *ctx ) +static void r200RenderFinish( struct gl_context *ctx ) { } -static void r200ResetLineStipple( GLcontext *ctx ) +static void r200ResetLineStipple( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); R200_STATECHANGE( rmesa, lin ); @@ -675,7 +678,7 @@ static const char *getFallbackString(GLuint bit) } -void r200Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ) +void r200Fallback( struct gl_context *ctx, GLuint bit, GLboolean mode ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -742,7 +745,7 @@ void r200Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ) * NV_texture_rectangle). */ void -r200PointsBitmap( GLcontext *ctx, GLint px, GLint py, +r200PointsBitmap( struct gl_context *ctx, GLint px, GLint py, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap ) @@ -917,7 +920,7 @@ r200PointsBitmap( GLcontext *ctx, GLint px, GLint py, /* Initialization. */ /**********************************************************************/ -void r200InitSwtcl( GLcontext *ctx ) +void r200InitSwtcl( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); r200ContextPtr rmesa = R200_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.h b/src/mesa/drivers/dri/r200/r200_swtcl.h index b0905879d7..668e175603 100644 --- a/src/mesa/drivers/dri/r200/r200_swtcl.h +++ b/src/mesa/drivers/dri/r200/r200_swtcl.h @@ -38,32 +38,32 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "swrast/swrast.h" #include "r200_context.h" -extern void r200InitSwtcl( GLcontext *ctx ); +extern void r200InitSwtcl( struct gl_context *ctx ); -extern void r200ChooseRenderState( GLcontext *ctx ); -extern void r200ChooseVertexState( GLcontext *ctx ); +extern void r200ChooseRenderState( struct gl_context *ctx ); +extern void r200ChooseVertexState( struct gl_context *ctx ); -extern void r200CheckTexSizes( GLcontext *ctx ); +extern void r200CheckTexSizes( struct gl_context *ctx ); -extern void r200BuildVertices( GLcontext *ctx, GLuint start, GLuint count, +extern void r200BuildVertices( struct gl_context *ctx, GLuint start, GLuint count, GLuint newinputs ); extern void r200PrintSetupFlags(char *msg, GLuint flags ); -extern void r200_translate_vertex( GLcontext *ctx, +extern void r200_translate_vertex( struct gl_context *ctx, const radeonVertex *src, SWvertex *dst ); -extern void r200_print_vertex( GLcontext *ctx, const radeonVertex *v ); +extern void r200_print_vertex( struct gl_context *ctx, const radeonVertex *v ); -extern void r200_import_float_colors( GLcontext *ctx ); -extern void r200_import_float_spec_colors( GLcontext *ctx ); +extern void r200_import_float_colors( struct gl_context *ctx ); +extern void r200_import_float_spec_colors( struct gl_context *ctx ); -extern void r200PointsBitmap( GLcontext *ctx, GLint px, GLint py, +extern void r200PointsBitmap( struct gl_context *ctx, GLint px, GLint py, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap ); -void r200_swtcl_flush(GLcontext *ctx, uint32_t current_offset); +void r200_swtcl_flush(struct gl_context *ctx, uint32_t current_offset); #endif diff --git a/src/mesa/drivers/dri/r200/r200_tcl.c b/src/mesa/drivers/dri/r200/r200_tcl.c index 4ae0f30491..84db7c9d4e 100644 --- a/src/mesa/drivers/dri/r200/r200_tcl.c +++ b/src/mesa/drivers/dri/r200/r200_tcl.c @@ -177,7 +177,7 @@ while (0) * discrete and there are no intervening state changes. (Somewhat * duplicates changes to DrawArrays code) */ -static void r200EmitPrim( GLcontext *ctx, +static void r200EmitPrim( struct gl_context *ctx, GLenum prim, GLuint hwprim, GLuint start, @@ -241,7 +241,7 @@ static void r200EmitPrim( GLcontext *ctx, /* External entrypoints */ /**********************************************************************/ -void r200EmitPrimitive( GLcontext *ctx, +void r200EmitPrimitive( struct gl_context *ctx, GLuint first, GLuint last, GLuint flags ) @@ -249,7 +249,7 @@ void r200EmitPrimitive( GLcontext *ctx, tcl_render_tab_verts[flags&PRIM_MODE_MASK]( ctx, first, last, flags ); } -void r200EmitEltPrimitive( GLcontext *ctx, +void r200EmitEltPrimitive( struct gl_context *ctx, GLuint first, GLuint last, GLuint flags ) @@ -257,7 +257,7 @@ void r200EmitEltPrimitive( GLcontext *ctx, tcl_render_tab_elts[flags&PRIM_MODE_MASK]( ctx, first, last, flags ); } -void r200TclPrimitive( GLcontext *ctx, +void r200TclPrimitive( struct gl_context *ctx, GLenum prim, int hw_prim ) { @@ -265,6 +265,8 @@ void r200TclPrimitive( GLcontext *ctx, GLuint newprim = hw_prim | R200_VF_TCL_OUTPUT_VTX_ENABLE; radeon_prepare_render(&rmesa->radeon); + if (rmesa->radeon.NewGLState) + r200ValidateState( ctx ); if (newprim != rmesa->tcl.hw_primitive || !discrete_prim[hw_prim&0xf]) { @@ -337,7 +339,7 @@ r200InitStaticFogData( void ) * Fog blend factors are in the range [0,1]. */ float -r200ComputeFogBlendFactor( GLcontext *ctx, GLfloat fogcoord ) +r200ComputeFogBlendFactor( struct gl_context *ctx, GLfloat fogcoord ) { GLfloat end = ctx->Fog.End; GLfloat d, temp; @@ -372,7 +374,7 @@ r200ComputeFogBlendFactor( GLcontext *ctx, GLfloat fogcoord ) * Predict total emit size for next rendering operation so there is no flush in middle of rendering * Prediction has to aim towards the best possible value that is worse than worst case scenario */ -static GLuint r200EnsureEmitSize( GLcontext * ctx , GLubyte* vimap_rev ) +static GLuint r200EnsureEmitSize( struct gl_context * ctx , GLubyte* vimap_rev ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -437,7 +439,7 @@ static GLuint r200EnsureEmitSize( GLcontext * ctx , GLubyte* vimap_rev ) /* TCL render. */ -static GLboolean r200_run_tcl_render( GLcontext *ctx, +static GLboolean r200_run_tcl_render( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -594,7 +596,7 @@ const struct tnl_pipeline_stage _r200_tcl_stage = */ -static void transition_to_swtnl( GLcontext *ctx ) +static void transition_to_swtnl( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -618,7 +620,7 @@ static void transition_to_swtnl( GLcontext *ctx ) rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] &= ~(R200_VAP_TCL_ENABLE|R200_VAP_PROG_VTX_SHADER_ENABLE); } -static void transition_to_hwtnl( GLcontext *ctx ) +static void transition_to_hwtnl( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -688,7 +690,7 @@ static char *getFallbackString(GLuint bit) -void r200TclFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) +void r200TclFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint oldfallback = rmesa->radeon.TclFallback; diff --git a/src/mesa/drivers/dri/r200/r200_tcl.h b/src/mesa/drivers/dri/r200/r200_tcl.h index f191ddc7eb..53a1f11e9d 100644 --- a/src/mesa/drivers/dri/r200/r200_tcl.h +++ b/src/mesa/drivers/dri/r200/r200_tcl.h @@ -37,17 +37,17 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r200_context.h" -extern void r200TclPrimitive( GLcontext *ctx, GLenum prim, int hw_prim ); -extern void r200EmitEltPrimitive( GLcontext *ctx, GLuint first, GLuint last, +extern void r200TclPrimitive( struct gl_context *ctx, GLenum prim, int hw_prim ); +extern void r200EmitEltPrimitive( struct gl_context *ctx, GLuint first, GLuint last, GLuint flags ); -extern void r200EmitPrimitive( GLcontext *ctx, GLuint first, GLuint last, +extern void r200EmitPrimitive( struct gl_context *ctx, GLuint first, GLuint last, GLuint flags ); -extern void r200TclFallback( GLcontext *ctx, GLuint bit, GLboolean mode ); +extern void r200TclFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ); extern void r200InitStaticFogData( void ); -extern float r200ComputeFogBlendFactor( GLcontext *ctx, GLfloat fogcoord ); +extern float r200ComputeFogBlendFactor( struct gl_context *ctx, GLfloat fogcoord ); #define R200_TCL_FALLBACK_RASTER 0x1 /* rasterization */ #define R200_TCL_FALLBACK_UNFILLED 0x2 /* unfilled tris */ diff --git a/src/mesa/drivers/dri/r200/r200_tex.c b/src/mesa/drivers/dri/r200/r200_tex.c index 6723b12bf4..5207c2901a 100644 --- a/src/mesa/drivers/dri/r200/r200_tex.c +++ b/src/mesa/drivers/dri/r200/r200_tex.c @@ -294,7 +294,7 @@ static void r200SetTexBorderColor( radeonTexObjPtr t, const GLfloat color[4] ) t->pp_border_color = radeonPackColor( 4, c[0], c[1], c[2], c[3] ); } -static void r200TexEnv( GLcontext *ctx, GLenum target, +static void r200TexEnv( struct gl_context *ctx, GLenum target, GLenum pname, const GLfloat *param ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -366,7 +366,7 @@ static void r200TexEnv( GLcontext *ctx, GLenum target, * next UpdateTextureState */ -static void r200TexParameter( GLcontext *ctx, GLenum target, +static void r200TexParameter( struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj, GLenum pname, const GLfloat *params ) { @@ -409,7 +409,7 @@ static void r200TexParameter( GLcontext *ctx, GLenum target, } -static void r200DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj) +static void r200DeleteTexture(struct gl_context * ctx, struct gl_texture_object *texObj) { r200ContextPtr rmesa = R200_CONTEXT(ctx); radeonTexObj* t = radeon_tex_obj(texObj); @@ -446,7 +446,7 @@ static void r200DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj) * Basically impossible to do this on the fly - just collect some * basic info & do the checks from ValidateState(). */ -static void r200TexGen( GLcontext *ctx, +static void r200TexGen( struct gl_context *ctx, GLenum coord, GLenum pname, const GLfloat *params ) @@ -464,7 +464,7 @@ static void r200TexGen( GLcontext *ctx, * allocate the default texture objects. * Fixup MaxAnisotropy according to user preference. */ -static struct gl_texture_object *r200NewTextureObject(GLcontext * ctx, +static struct gl_texture_object *r200NewTextureObject(struct gl_context * ctx, GLuint name, GLenum target) { diff --git a/src/mesa/drivers/dri/r200/r200_tex.h b/src/mesa/drivers/dri/r200/r200_tex.h index 1a1e7038df..8bebf8a037 100644 --- a/src/mesa/drivers/dri/r200/r200_tex.h +++ b/src/mesa/drivers/dri/r200/r200_tex.h @@ -42,7 +42,7 @@ extern void r200SetTexOffset(__DRIcontext *pDRICtx, GLint texname, unsigned long long offset, GLint depth, GLuint pitch); -extern void r200UpdateTextureState( GLcontext *ctx ); +extern void r200UpdateTextureState( struct gl_context *ctx ); extern int r200UploadTexImages( r200ContextPtr rmesa, radeonTexObjPtr t, GLuint face ); @@ -50,8 +50,8 @@ extern void r200DestroyTexObj( r200ContextPtr rmesa, radeonTexObjPtr t ); extern void r200InitTextureFuncs( radeonContextPtr radeon, struct dd_function_table *functions ); -extern void r200UpdateFragmentShader( GLcontext *ctx ); +extern void r200UpdateFragmentShader( struct gl_context *ctx ); -extern void set_re_cntl_d3d( GLcontext *ctx, int unit, GLboolean use_d3d ); +extern void set_re_cntl_d3d( struct gl_context *ctx, int unit, GLboolean use_d3d ); #endif /* __R200_TEX_H__ */ diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c index 9ccf30c3ac..690bec640b 100644 --- a/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/src/mesa/drivers/dri/r200/r200_texstate.c @@ -302,7 +302,7 @@ do { \ * Texture unit state management */ -static GLboolean r200UpdateTextureEnv( GLcontext *ctx, int unit, int slot, GLuint replaceargs ) +static GLboolean r200UpdateTextureEnv( struct gl_context *ctx, int unit, int slot, GLuint replaceargs ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; @@ -869,7 +869,7 @@ void r200SetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv) #define REF_COLOR 1 #define REF_ALPHA 2 -static GLboolean r200UpdateAllTexEnv( GLcontext *ctx ) +static GLboolean r200UpdateAllTexEnv( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLint i, j, currslot; @@ -1203,7 +1203,7 @@ static GLuint r200_need_dis_texgen(const GLbitfield texGenEnabled, /* * Returns GL_FALSE if fallback required. */ -static GLboolean r200_validate_texgen( GLcontext *ctx, GLuint unit ) +static GLboolean r200_validate_texgen( struct gl_context *ctx, GLuint unit ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; @@ -1385,7 +1385,7 @@ static GLboolean r200_validate_texgen( GLcontext *ctx, GLuint unit ) return GL_TRUE; } -void set_re_cntl_d3d( GLcontext *ctx, int unit, GLboolean use_d3d ) +void set_re_cntl_d3d( struct gl_context *ctx, int unit, GLboolean use_d3d ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -1521,7 +1521,7 @@ static void setup_hardware_state(r200ContextPtr rmesa, radeonTexObj *t) } -static GLboolean r200_validate_texture(GLcontext *ctx, struct gl_texture_object *texObj, int unit) +static GLboolean r200_validate_texture(struct gl_context *ctx, struct gl_texture_object *texObj, int unit) { r200ContextPtr rmesa = R200_CONTEXT(ctx); radeonTexObj *t = radeon_tex_obj(texObj); @@ -1564,7 +1564,7 @@ static GLboolean r200_validate_texture(GLcontext *ctx, struct gl_texture_object return !t->border_fallback; } -static GLboolean r200UpdateTextureUnit(GLcontext *ctx, int unit) +static GLboolean r200UpdateTextureUnit(struct gl_context *ctx, int unit) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint unitneeded = rmesa->state.texture.unit[unit].unitneeded; @@ -1588,7 +1588,7 @@ static GLboolean r200UpdateTextureUnit(GLcontext *ctx, int unit) } -void r200UpdateTextureState( GLcontext *ctx ) +void r200UpdateTextureState( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLboolean ok; diff --git a/src/mesa/drivers/dri/r200/r200_vertprog.c b/src/mesa/drivers/dri/r200/r200_vertprog.c index 5d268319f3..5d69012a81 100644 --- a/src/mesa/drivers/dri/r200/r200_vertprog.c +++ b/src/mesa/drivers/dri/r200/r200_vertprog.c @@ -100,7 +100,7 @@ static struct{ }; #undef OPN -static GLboolean r200VertexProgUpdateParams(GLcontext *ctx, struct r200_vertex_program *vp) +static GLboolean r200VertexProgUpdateParams(struct gl_context *ctx, struct r200_vertex_program *vp) { r200ContextPtr rmesa = R200_CONTEXT( ctx ); GLfloat *fcmd = (GLfloat *)&rmesa->hw.vpp[0].cmd[VPP_CMD_0 + 1]; @@ -396,7 +396,7 @@ static unsigned long op_operands(enum prog_opcode opcode) * * \return GL_TRUE for success, GL_FALSE for failure. */ -static GLboolean r200_translate_vertex_program(GLcontext *ctx, struct r200_vertex_program *vp) +static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r200_vertex_program *vp) { struct gl_vertex_program *mesa_vp = &vp->mesa_program; struct prog_instruction *vpi; @@ -1098,7 +1098,7 @@ else { return GL_TRUE; } -void r200SetupVertexProg( GLcontext *ctx ) { +void r200SetupVertexProg( struct gl_context *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); struct r200_vertex_program *vp = (struct r200_vertex_program *)ctx->VertexProgram.Current; GLboolean fallback; @@ -1179,7 +1179,7 @@ void r200SetupVertexProg( GLcontext *ctx ) { static void -r200BindProgram(GLcontext *ctx, GLenum target, struct gl_program *prog) +r200BindProgram(struct gl_context *ctx, GLenum target, struct gl_program *prog) { r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -1194,7 +1194,7 @@ r200BindProgram(GLcontext *ctx, GLenum target, struct gl_program *prog) } static struct gl_program * -r200NewProgram(GLcontext *ctx, GLenum target, GLuint id) +r200NewProgram(struct gl_context *ctx, GLenum target, GLuint id) { struct r200_vertex_program *vp; @@ -1213,13 +1213,13 @@ r200NewProgram(GLcontext *ctx, GLenum target, GLuint id) static void -r200DeleteProgram(GLcontext *ctx, struct gl_program *prog) +r200DeleteProgram(struct gl_context *ctx, struct gl_program *prog) { _mesa_delete_program(ctx, prog); } static GLboolean -r200ProgramStringNotify(GLcontext *ctx, GLenum target, struct gl_program *prog) +r200ProgramStringNotify(struct gl_context *ctx, GLenum target, struct gl_program *prog) { struct r200_vertex_program *vp = (void *)prog; r200ContextPtr rmesa = R200_CONTEXT(ctx); @@ -1244,7 +1244,7 @@ r200ProgramStringNotify(GLcontext *ctx, GLenum target, struct gl_program *prog) } static GLboolean -r200IsProgramNative(GLcontext *ctx, GLenum target, struct gl_program *prog) +r200IsProgramNative(struct gl_context *ctx, GLenum target, struct gl_program *prog) { struct r200_vertex_program *vp = (void *)prog; diff --git a/src/mesa/drivers/dri/r200/r200_vertprog.h b/src/mesa/drivers/dri/r200/r200_vertprog.h index 938237680c..4757f4b32b 100644 --- a/src/mesa/drivers/dri/r200/r200_vertprog.h +++ b/src/mesa/drivers/dri/r200/r200_vertprog.h @@ -11,7 +11,7 @@ typedef struct { } VERTEX_SHADER_INSTRUCTION; extern void r200InitShaderFuncs(struct dd_function_table *functions); -extern void r200SetupVertexProg( GLcontext *ctx ); +extern void r200SetupVertexProg( struct gl_context *ctx ); #define VSF_FLAG_X 1 #define VSF_FLAG_Y 2 diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c index 3b2b06fc2b..8be32ea91f 100644 --- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c @@ -74,7 +74,7 @@ static void use_temporary(struct r300_fragment_program_code *code, unsigned int code->pixsize = index; } -static unsigned int use_source(struct r300_fragment_program_code* code, struct radeon_pair_instruction_source src) +static unsigned int use_source(struct r300_fragment_program_code* code, struct rc_pair_instruction_source src) { if (src.File == RC_FILE_CONSTANT) { return src.Index | (1 << 5); @@ -133,6 +133,8 @@ static unsigned int translate_alpha_opcode(struct r300_fragment_program_compiler */ static int emit_alu(struct r300_emit_state * emit, struct rc_pair_instruction* inst) { + int ip; + int j; PROG_CODE; if (code->alu.length >= c->Base.max_alu_insts) { @@ -140,20 +142,20 @@ static int emit_alu(struct r300_emit_state * emit, struct rc_pair_instruction* i return 0; } - int ip = code->alu.length++; - int j; + ip = code->alu.length++; code->alu.inst[ip].rgb_inst = translate_rgb_opcode(c, inst->RGB.Opcode); code->alu.inst[ip].alpha_inst = translate_alpha_opcode(c, inst->Alpha.Opcode); for(j = 0; j < 3; ++j) { unsigned int src = use_source(code, inst->RGB.Src[j]); + unsigned int arg; code->alu.inst[ip].rgb_addr |= src << (6*j); src = use_source(code, inst->Alpha.Src[j]); code->alu.inst[ip].alpha_addr |= src << (6*j); - unsigned int arg = r300FPTranslateRGBSwizzle(inst->RGB.Arg[j].Source, inst->RGB.Arg[j].Swizzle); + arg = r300FPTranslateRGBSwizzle(inst->RGB.Arg[j].Source, inst->RGB.Arg[j].Swizzle); arg |= inst->RGB.Arg[j].Abs << 6; arg |= inst->RGB.Arg[j].Negate << 5; code->alu.inst[ip].rgb_inst |= arg << (7*j); @@ -259,6 +261,10 @@ static int finish_node(struct r300_emit_state * emit) { struct r300_fragment_program_compiler * c = emit->compiler; struct r300_fragment_program_code *code = &emit->compiler->code->code.r300; + unsigned alu_offset; + unsigned alu_end; + unsigned tex_offset; + unsigned tex_end; if (code->alu.length == emit->node_first_alu) { /* Generate a single NOP for this node */ @@ -268,10 +274,10 @@ static int finish_node(struct r300_emit_state * emit) return 0; } - unsigned alu_offset = emit->node_first_alu; - unsigned alu_end = code->alu.length - alu_offset - 1; - unsigned tex_offset = emit->node_first_tex; - unsigned tex_end = code->tex.length - tex_offset - 1; + alu_offset = emit->node_first_alu; + alu_end = code->alu.length - alu_offset - 1; + tex_offset = emit->node_first_tex; + tex_end = code->tex.length - tex_offset - 1; if (code->tex.length == emit->node_first_tex) { if (emit->current_node > 0) { @@ -334,6 +340,9 @@ static int begin_tex(struct r300_emit_state * emit) static int emit_tex(struct r300_emit_state * emit, struct rc_instruction * inst) { + unsigned int unit; + unsigned int dest; + unsigned int opcode; PROG_CODE; if (code->tex.length >= R300_PFS_MAX_TEX_INST) { @@ -341,9 +350,8 @@ static int emit_tex(struct r300_emit_state * emit, struct rc_instruction * inst) return 0; } - unsigned int unit = inst->U.I.TexSrcUnit; - unsigned int dest = inst->U.I.DstReg.Index; - unsigned int opcode; + unit = inst->U.I.TexSrcUnit; + dest = inst->U.I.DstReg.Index; switch(inst->U.I.Opcode) { case RC_OPCODE_KIL: opcode = R300_TEX_OP_KIL; break; diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c index caa48fe478..2d28b06539 100644 --- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c +++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c @@ -94,6 +94,9 @@ static const struct swizzle_data* lookup_native_swizzle(unsigned int swizzle) */ static int r300_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg) { + unsigned int relevant; + int j; + if (reg.Abs) reg.Negate = RC_MASK_NONE; @@ -101,8 +104,6 @@ static int r300_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg) opcode == RC_OPCODE_TEX || opcode == RC_OPCODE_TXB || opcode == RC_OPCODE_TXP) { - int j; - if (reg.Abs || reg.Negate) return 0; @@ -117,8 +118,7 @@ static int r300_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg) return 1; } - unsigned int relevant = 0; - int j; + relevant = 0; for(j = 0; j < 3; ++j) if (GET_SWZ(reg.Swizzle, j) != RC_SWIZZLE_UNUSED) @@ -154,9 +154,10 @@ static void r300_swizzle_split( unsigned int matchcount = 0; unsigned int matchmask = 0; for(comp = 0; comp < 3; ++comp) { + unsigned int swz; if (!GET_BIT(mask, comp)) continue; - unsigned int swz = GET_SWZ(src.Swizzle, comp); + swz = GET_SWZ(src.Swizzle, comp); if (swz == RC_SWIZZLE_UNUSED) continue; if (swz == GET_SWZ(sd->hash, comp)) { diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c index 08785716db..d7d49e514b 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c @@ -392,9 +392,9 @@ static void ei_if(struct r300_vertex_program_compiler * compiler, * don't already have one. */ if (!compiler->PredicateMask) { unsigned int writemasks[RC_REGISTER_MAX_INDEX]; - memset(writemasks, 0, sizeof(writemasks)); struct rc_instruction * inst; unsigned int i; + memset(writemasks, 0, sizeof(writemasks)); for(inst = compiler->Base.Program.Instructions.Next; inst != &compiler->Base.Program.Instructions; inst = inst->Next) { diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c index 627ce374ef..289bb87ae5 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c @@ -39,10 +39,12 @@ int r500_transform_IF( struct rc_instruction * inst, void* data) { + struct rc_instruction * inst_mov; + if (inst->U.I.Opcode != RC_OPCODE_IF) return 0; - struct rc_instruction * inst_mov = rc_insert_new_instruction(c, inst->Prev); + inst_mov = rc_insert_new_instruction(c, inst->Prev); inst_mov->U.I.Opcode = RC_OPCODE_MOV; inst_mov->U.I.DstReg.WriteMask = 0; inst_mov->U.I.WriteALUResult = RC_ALURESULT_W; @@ -251,12 +253,11 @@ void r500FragmentProgramDump(struct radeon_compiler *c, void *user) { struct r300_fragment_program_compiler *compiler = (struct r300_fragment_program_compiler*)c; struct r500_fragment_program_code *code = &compiler->code->code.r500; - fprintf(stderr, "R500 Fragment Program:\n--------\n"); - int n, i; uint32_t inst; uint32_t inst0; char *str = NULL; + fprintf(stderr, "R500 Fragment Program:\n--------\n"); for (n = 0; n < code->inst_end+1; n++) { inst0 = inst = code->inst[n].inst0; diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c index 54cff9169a..6f101c68eb 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c @@ -198,7 +198,7 @@ static void use_temporary(struct r500_fragment_program_code* code, unsigned int code->max_temp_idx = index; } -static unsigned int use_source(struct r500_fragment_program_code* code, struct radeon_pair_instruction_source src) +static unsigned int use_source(struct r500_fragment_program_code* code, struct rc_pair_instruction_source src) { if (src.File == RC_FILE_CONSTANT) { return src.Index | 0x100; @@ -227,6 +227,7 @@ static void alu_nop(struct r300_fragment_program_compiler *c, int ip) */ static void emit_paired(struct r300_fragment_program_compiler *c, struct rc_pair_instruction *inst) { + int ip; PROG_CODE; if (code->inst_end >= c->Base.max_alu_insts-1) { @@ -234,7 +235,7 @@ static void emit_paired(struct r300_fragment_program_compiler *c, struct rc_pair return; } - int ip = ++code->inst_end; + ip = ++code->inst_end; /* Quirk: MDH/MDV (DDX/DDY) need a NOP on previous non-TEX instructions. */ if (inst->RGB.Opcode == RC_OPCODE_DDX || inst->Alpha.Opcode == RC_OPCODE_DDX || @@ -250,7 +251,7 @@ static void emit_paired(struct r300_fragment_program_compiler *c, struct rc_pair if (inst->RGB.OutputWriteMask || inst->Alpha.OutputWriteMask || inst->Alpha.DepthWriteMask) { code->inst[ip].inst0 = R500_INST_TYPE_OUT; if (inst->WriteALUResult) { - error("%s: cannot write output and ALU result at the same time"); + error("Cannot write output and ALU result at the same time"); return; } } else { @@ -357,6 +358,7 @@ static unsigned int translate_strq_swizzle(unsigned int swizzle) */ static int emit_tex(struct r300_fragment_program_compiler *c, struct rc_sub_instruction *inst) { + int ip; PROG_CODE; if (code->inst_end >= c->Base.max_alu_insts-1) { @@ -364,7 +366,7 @@ static int emit_tex(struct r300_fragment_program_compiler *c, struct rc_sub_inst return 0; } - int ip = ++code->inst_end; + ip = ++code->inst_end; code->inst[ip].inst0 = R500_INST_TYPE_TEX | (inst->DstReg.WriteMask << 11) @@ -407,12 +409,14 @@ static int emit_tex(struct r300_fragment_program_compiler *c, struct rc_sub_inst static void emit_flowcontrol(struct emit_state * s, struct rc_instruction * inst) { + unsigned int newip; + if (s->Code->inst_end >= s->C->max_alu_insts-1) { rc_error(s->C, "emit_tex: Too many instructions"); return; } - unsigned int newip = ++s->Code->inst_end; + newip = ++s->Code->inst_end; /* Currently all loops use the same integer constant to intialize * the loop variables. */ @@ -623,6 +627,8 @@ void r500BuildFragmentProgramHwCode(struct radeon_compiler *c, void *user) if (code->inst_end == -1 || (code->inst[code->inst_end].inst0 & R500_INST_TYPE_MASK) != R500_INST_TYPE_OUT) { + int ip; + /* This may happen when dead-code elimination is disabled or * when most of the fragment program logic is leading to a KIL */ if (code->inst_end >= compiler->Base.max_alu_insts-1) { @@ -630,7 +636,7 @@ void r500BuildFragmentProgramHwCode(struct radeon_compiler *c, void *user) return; } - int ip = ++code->inst_end; + ip = ++code->inst_end; code->inst[ip].inst0 = R500_INST_TYPE_OUT | R500_INST_TEX_SEM_WAIT; } diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_code.c b/src/mesa/drivers/dri/r300/compiler/radeon_code.c index 0eab18c344..6842fb873b 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_code.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_code.c @@ -28,6 +28,7 @@ #include "radeon_code.h" #include <stdlib.h> +#include <stdio.h> #include <string.h> #include "radeon_program.h" @@ -171,3 +172,16 @@ unsigned rc_constants_add_immediate_scalar(struct rc_constant_list * c, float da return rc_constants_add(c, &constant); } + +void rc_constants_print(struct rc_constant_list * c) +{ + unsigned int i; + for(i = 0; i < c->Count; i++) { + if (c->Constants[i].Type == RC_CONSTANT_IMMEDIATE) { + float * values = c->Constants[i].u.Immediate; + fprintf(stderr, "CONST[%u] = " + "{ %10.4f %10.4f %10.4f %10.4f }\n", + i, values[0],values[1], values[2], values[3]); + } + } +} diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_code.h b/src/mesa/drivers/dri/r300/compiler/radeon_code.h index f76676fae8..cfb6df2cd7 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_code.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_code.h @@ -60,6 +60,7 @@ enum { RC_STATE_R300_WINDOW_DIMENSION, RC_STATE_R300_TEXRECT_FACTOR, + RC_STATE_R300_TEXSCALE_FACTOR, RC_STATE_R300_VIEWPORT_SCALE, RC_STATE_R300_VIEWPORT_OFFSET }; @@ -89,6 +90,7 @@ unsigned rc_constants_add(struct rc_constant_list * c, struct rc_constant * cons unsigned rc_constants_add_state(struct rc_constant_list * c, unsigned state1, unsigned state2); unsigned rc_constants_add_immediate_vec4(struct rc_constant_list * c, const float * data); unsigned rc_constants_add_immediate_scalar(struct rc_constant_list * c, float data, unsigned * swizzle); +void rc_constants_print(struct rc_constant_list * c); /** * Compare functions. @@ -126,11 +128,7 @@ struct r300_fragment_program_external_state { struct { /** * If the sampler is used as a shadow sampler, - * this field is: - * 0 - GL_LUMINANCE - * 1 - GL_INTENSITY - * 2 - GL_ALPHA - * depending on the depth texture mode. + * this field contains swizzle depending on the depth texture mode. */ unsigned depth_texture_swizzle:12; @@ -150,13 +148,9 @@ struct r300_fragment_program_external_state { unsigned compare_mode_enabled : 1; /** - * If the sampler needs to fake NPOT, this field is set. - */ - unsigned fake_npot : 1; - - /** - * If the sampler will recieve non-normalized coords, - * this field is set. + * If the sampler will receive non-normalized coords, + * this field is set. The scaling factor is given by + * RC_STATE_R300_TEXRECT_FACTOR. */ unsigned non_normalized_coords : 1; @@ -166,7 +160,13 @@ struct r300_fragment_program_external_state { * If this field is \ref RC_WRAP_NONE (aka 0), no wrapping maths * will be performed on the coordinates. */ - unsigned wrap_mode : 2; + unsigned wrap_mode : 3; + + /** + * The coords are scaled after applying the wrap mode emulation + * and right before texture fetch. The scaling factor is given by + * RC_STATE_R300_TEXSCALE_FACTOR. */ + unsigned clamp_and_scale_before_fetch : 1; } unit[16]; }; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c index e73700f84a..a27d395587 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c @@ -29,49 +29,32 @@ #include "radeon_program.h" +struct read_write_mask_data { + void * UserData; + rc_read_write_mask_fn Cb; +}; + static void reads_normal_callback( - rc_read_write_chan_fn cb, + void * userdata, struct rc_instruction * fullinst, - struct rc_src_register src, - void * userdata) + struct rc_src_register * src) { + struct read_write_mask_data * cb_data = userdata; unsigned int refmask = 0; unsigned int chan; for(chan = 0; chan < 4; chan++) { - refmask |= 1 << GET_SWZ(src.Swizzle, chan); + refmask |= 1 << GET_SWZ(src->Swizzle, chan); } refmask &= RC_MASK_XYZW; - if (refmask) - cb(userdata, fullinst, src.File, src.Index, refmask); - - if (refmask && src.RelAddr) - cb(userdata, fullinst, RC_FILE_ADDRESS, 0, RC_MASK_X); -} - -static void reads_normal(struct rc_instruction * fullinst, rc_read_write_chan_fn cb, void * userdata) -{ - struct rc_sub_instruction * inst = &fullinst->U.I; - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->Opcode); - - for(unsigned int src = 0; src < opcode->NumSrcRegs; ++src) { - - if (inst->SrcReg[src].File == RC_FILE_NONE) - return; + if (refmask) { + cb_data->Cb(cb_data->UserData, fullinst, src->File, + src->Index, refmask); + } - if (inst->SrcReg[src].File == RC_FILE_PRESUB) { - unsigned int i; - unsigned int srcp_regs = rc_presubtract_src_reg_count( - inst->PreSub.Opcode); - for( i = 0; i < srcp_regs; i++) { - reads_normal_callback(cb, fullinst, - inst->PreSub.SrcReg[i], - userdata); - } - } else { - reads_normal_callback(cb, fullinst, - inst->SrcReg[src], userdata); - } + if (refmask && src->RelAddr) { + cb_data->Cb(cb_data->UserData, fullinst, RC_FILE_ADDRESS, 0, + RC_MASK_X); } } @@ -112,7 +95,7 @@ static void pair_get_src_refmasks(unsigned int * refmasks, } } -static void reads_pair(struct rc_instruction * fullinst, rc_read_write_mask_fn cb, void * userdata) +static void reads_pair(struct rc_instruction * fullinst, rc_read_write_mask_fn cb, void * userdata) { struct rc_pair_instruction * inst = &fullinst->U.P; unsigned int refmasks[3] = { 0, 0, 0 }; @@ -143,6 +126,74 @@ static void reads_pair(struct rc_instruction * fullinst, rc_read_write_mask_fn } } +static void pair_sub_for_all_args( + struct rc_instruction * fullinst, + struct rc_pair_sub_instruction * sub, + rc_pair_read_arg_fn cb, + void * userdata) +{ + int i; + const struct rc_opcode_info * info = rc_get_opcode_info(sub->Opcode); + + for(i = 0; i < info->NumSrcRegs; i++) { + cb(userdata, fullinst, &sub->Arg[i]); + } +} + +/* This function calls the callback function (cb) for each source used by + * the instruction. + * */ +void rc_for_all_reads_src( + struct rc_instruction * inst, + rc_read_src_fn cb, + void * userdata) +{ + const struct rc_opcode_info * opcode = + rc_get_opcode_info(inst->U.I.Opcode); + + /* This function only works with normal instructions. */ + if (inst->Type != RC_INSTRUCTION_NORMAL) { + assert(0); + return; + } + + for(unsigned int src = 0; src < opcode->NumSrcRegs; ++src) { + + if (inst->U.I.SrcReg[src].File == RC_FILE_NONE) + continue; + + if (inst->U.I.SrcReg[src].File == RC_FILE_PRESUB) { + unsigned int i; + unsigned int srcp_regs = rc_presubtract_src_reg_count( + inst->U.I.PreSub.Opcode); + for( i = 0; i < srcp_regs; i++) { + cb(userdata, inst, &inst->U.I.PreSub.SrcReg[i]); + } + } else { + cb(userdata, inst, &inst->U.I.SrcReg[src]); + } + } +} + +/** + * This function calls the callback function (cb) for each arg of the RGB and + * alpha components. + */ +void rc_pair_for_all_reads_arg( + struct rc_instruction * inst, + rc_pair_read_arg_fn cb, + void * userdata) +{ + /* This function only works with pair instructions. */ + if (inst->Type != RC_INSTRUCTION_PAIR) { + assert(0); + return; + } + + pair_sub_for_all_args(inst, &inst->U.P.RGB, cb, userdata); + pair_sub_for_all_args(inst, &inst->U.P.Alpha, cb, userdata); +} + /** * Calls a callback function for all register reads. * @@ -153,7 +204,11 @@ static void reads_pair(struct rc_instruction * fullinst, rc_read_write_mask_fn void rc_for_all_reads_mask(struct rc_instruction * inst, rc_read_write_mask_fn cb, void * userdata) { if (inst->Type == RC_INSTRUCTION_NORMAL) { - reads_normal(inst, cb, userdata); + struct read_write_mask_data cb_data; + cb_data.UserData = userdata; + cb_data.Cb = cb; + + rc_for_all_reads_src(inst, reads_normal_callback, &cb_data); } else { reads_pair(inst, cb, userdata); } diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h index 795d9cc2b6..d10ae3c7b7 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h @@ -33,6 +33,8 @@ struct radeon_compiler; struct rc_instruction; struct rc_swizzle_caps; +struct rc_src_register; +struct rc_pair_instruction_arg; /** @@ -49,6 +51,16 @@ typedef void (*rc_read_write_mask_fn)(void * userdata, struct rc_instruction * i void rc_for_all_reads_mask(struct rc_instruction * inst, rc_read_write_mask_fn cb, void * userdata); void rc_for_all_writes_mask(struct rc_instruction * inst, rc_read_write_mask_fn cb, void * userdata); +typedef void (*rc_read_src_fn)(void * userdata, struct rc_instruction * inst, + struct rc_src_register * src); +void rc_for_all_reads_src(struct rc_instruction * inst, rc_read_src_fn cb, + void * userdata); + +typedef void (*rc_pair_read_arg_fn)(void * userdata, + struct rc_instruction * inst, struct rc_pair_instruction_arg * arg); +void rc_pair_for_all_reads_arg(struct rc_instruction * inst, + rc_pair_read_arg_fn cb, void * userdata); + typedef void (*rc_remap_register_fn)(void * userdata, struct rc_instruction * inst, rc_register_file * pfile, unsigned int * pindex); void rc_remap_registers(struct rc_instruction * inst, rc_remap_register_fn cb, void * userdata); diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c index 9d17b4772a..87906f37b1 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c @@ -106,10 +106,12 @@ static void push_loop(struct deadcode_state * s) static void push_branch(struct deadcode_state * s) { + struct branchinfo * branch; + memory_pool_array_reserve(&s->C->Pool, struct branchinfo, s->BranchStack, s->BranchStackSize, s->BranchStackReserved, 1); - struct branchinfo * branch = &s->BranchStack[s->BranchStackSize++]; + branch = &s->BranchStack[s->BranchStackSize++]; branch->HaveElse = 0; memcpy(&branch->StoreEndif, &s->R, sizeof(s->R)); } @@ -152,6 +154,7 @@ static void update_instruction(struct deadcode_state * s, struct rc_instruction const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); struct instruction_state * insts = &s->Instructions[inst->IP]; unsigned int usedmask = 0; + unsigned int srcmasks[3]; if (opcode->HasDstReg) { unsigned char * pused = get_used_ptr(s, inst->U.I.DstReg.File, inst->U.I.DstReg.Index); @@ -180,7 +183,6 @@ static void update_instruction(struct deadcode_state * s, struct rc_instruction } } - unsigned int srcmasks[3]; rc_compute_sources_for_writemask(inst, usedmask, srcmasks); for(unsigned int src = 0; src < opcode->NumSrcRegs; ++src) { @@ -219,6 +221,7 @@ void rc_dataflow_deadcode(struct radeon_compiler * c, void *user) unsigned int nr_instructions; unsigned has_temp_reladdr_src = 0; rc_dataflow_mark_outputs_fn dce = (rc_dataflow_mark_outputs_fn)user; + unsigned int ip; /* Give up if there is relative addressing of destination operands. */ for(struct rc_instruction * inst = c->Program.Instructions.Next; @@ -349,12 +352,14 @@ void rc_dataflow_deadcode(struct radeon_compiler * c, void *user) update_instruction(&s, inst); } - unsigned int ip = 0; + ip = 0; for(struct rc_instruction * inst = c->Program.Instructions.Next; inst != &c->Program.Instructions; inst = inst->Next, ++ip) { const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); int dead = 1; + unsigned int srcmasks[3]; + unsigned int usemask; if (!opcode->HasDstReg) { dead = 0; @@ -376,8 +381,7 @@ void rc_dataflow_deadcode(struct radeon_compiler * c, void *user) continue; } - unsigned int srcmasks[3]; - unsigned int usemask = s.Instructions[ip].WriteMask; + usemask = s.Instructions[ip].WriteMask; if (inst->U.I.WriteALUResult == RC_ALURESULT_X) usemask |= RC_MASK_X; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.c b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.c index 222e5b7e02..7bede344f3 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.c @@ -57,18 +57,21 @@ struct emulate_branch_state { static void handle_if(struct emulate_branch_state * s, struct rc_instruction * inst) { + struct branch_info * branch; + struct rc_instruction * inst_mov; + memory_pool_array_reserve(&s->C->Pool, struct branch_info, s->Branches, s->BranchCount, s->BranchReserved, 1); DBG("%s\n", __FUNCTION__); - struct branch_info * branch = &s->Branches[s->BranchCount++]; + branch = &s->Branches[s->BranchCount++]; memset(branch, 0, sizeof(struct branch_info)); branch->If = inst; /* Make a safety copy of the decision register, because we will need * it at ENDIF time and it might be overwritten in both branches. */ - struct rc_instruction * inst_mov = rc_insert_new_instruction(s->C, inst->Prev); + inst_mov = rc_insert_new_instruction(s->C, inst->Prev); inst_mov->U.I.Opcode = RC_OPCODE_MOV; inst_mov->U.I.DstReg.File = RC_FILE_TEMPORARY; inst_mov->U.I.DstReg.Index = rc_find_free_temporary(s->C); @@ -84,6 +87,8 @@ static void handle_if(struct emulate_branch_state * s, struct rc_instruction * i static void handle_else(struct emulate_branch_state * s, struct rc_instruction * inst) { + struct branch_info * branch; + if (!s->BranchCount) { rc_error(s->C, "Encountered ELSE outside of branches"); return; @@ -91,7 +96,7 @@ static void handle_else(struct emulate_branch_state * s, struct rc_instruction * DBG("%s\n", __FUNCTION__); - struct branch_info * branch = &s->Branches[s->BranchCount - 1]; + branch = &s->Branches[s->BranchCount - 1]; branch->Else = inst; } @@ -191,6 +196,10 @@ static void inject_cmp(struct emulate_branch_state * s, static void handle_endif(struct emulate_branch_state * s, struct rc_instruction * inst) { + struct branch_info * branch; + struct register_proxies IfProxies; + struct register_proxies ElseProxies; + if (!s->BranchCount) { rc_error(s->C, "Encountered ENDIF outside of branches"); return; @@ -198,9 +207,7 @@ static void handle_endif(struct emulate_branch_state * s, struct rc_instruction DBG("%s\n", __FUNCTION__); - struct branch_info * branch = &s->Branches[s->BranchCount - 1]; - struct register_proxies IfProxies; - struct register_proxies ElseProxies; + branch = &s->Branches[s->BranchCount - 1]; memset(&IfProxies, 0, sizeof(IfProxies)); memset(&ElseProxies, 0, sizeof(ElseProxies)); @@ -261,16 +268,19 @@ static void remap_output_function(void * userdata, struct rc_instruction * inst, */ static void fix_output_writes(struct emulate_branch_state * s, struct rc_instruction * inst) { + const struct rc_opcode_info * opcode; + if (!s->BranchCount) return; - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); + opcode = rc_get_opcode_info(inst->U.I.Opcode); if (!opcode->HasDstReg) return; if (inst->U.I.DstReg.File == RC_FILE_OUTPUT) { struct remap_output_data remap; + struct rc_instruction * inst_mov; remap.Output = inst->U.I.DstReg.Index; remap.Temporary = rc_find_free_temporary(s->C); @@ -281,7 +291,7 @@ static void fix_output_writes(struct emulate_branch_state * s, struct rc_instruc rc_remap_registers(inst, &remap_output_function, &remap); } - struct rc_instruction * inst_mov = rc_insert_new_instruction(s->C, s->C->Program.Instructions.Prev); + inst_mov = rc_insert_new_instruction(s->C, s->C->Program.Instructions.Prev); inst_mov->U.I.Opcode = RC_OPCODE_MOV; inst_mov->U.I.DstReg.File = RC_FILE_OUTPUT; inst_mov->U.I.DstReg.Index = remap.Output; @@ -299,12 +309,13 @@ static void fix_output_writes(struct emulate_branch_state * s, struct rc_instruc void rc_emulate_branches(struct radeon_compiler *c, void *user) { struct emulate_branch_state s; + struct rc_instruction * ptr; memset(&s, 0, sizeof(s)); s.C = c; /* Untypical loop because we may remove the current instruction */ - struct rc_instruction * ptr = c->Program.Instructions.Next; + ptr = c->Program.Instructions.Next; while(ptr != &c->Program.Instructions) { struct rc_instruction * inst = ptr; ptr = ptr->Next; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c index cd4fcbabb9..205eecd112 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c @@ -386,8 +386,6 @@ static int build_loop_info(struct radeon_compiler * c, struct loop_info * loop, case RC_OPCODE_SNE: break; default: - rc_error(c, "%s: expected conditional", - __FUNCTION__); return 0; } loop->Cond = loop->If->Prev; @@ -431,8 +429,10 @@ static int transform_loop(struct emulate_loop_state * s, loop = &s->Loops[s->LoopCount++]; - if (!build_loop_info(s->C, loop, inst)) + if (!build_loop_info(s->C, loop, inst)) { + rc_error(s->C, "Failed to build loop info\n"); return 0; + } if(try_unroll_loop(s->C, loop)){ return 1; @@ -511,11 +511,12 @@ void rc_emulate_loops(struct radeon_compiler *c, void *user) * loops are unrolled first. */ for( i = s->LoopCount - 1; i >= 0; i-- ){ + unsigned int iterations; + if(!s->Loops[i].EndLoop){ continue; } - unsigned int iterations = loop_max_possible_iterations( - s->C, &s->Loops[i]); + iterations = loop_max_possible_iterations(s->C, &s->Loops[i]); unroll_loop(s->C, &s->Loops[i], iterations); } } diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c index c15a9b1c45..41769e347e 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c @@ -163,7 +163,8 @@ static void copy_propagate(struct radeon_compiler * c, struct rc_instruction * i if (inst_mov->U.I.DstReg.File != RC_FILE_TEMPORARY || inst_mov->U.I.DstReg.RelAddr || - inst_mov->U.I.WriteALUResult) + inst_mov->U.I.WriteALUResult || + inst_mov->U.I.SaturateMode) return; memset(&s, 0, sizeof(s)); @@ -410,27 +411,34 @@ static void constant_folding(struct radeon_compiler * c, struct rc_instruction * /* Replace 0.0, 1.0 and 0.5 immediates by their explicit swizzles */ for(unsigned int src = 0; src < opcode->NumSrcRegs; ++src) { + struct rc_constant * constant; + struct rc_src_register newsrc; + int have_real_reference; + if (inst->U.I.SrcReg[src].File != RC_FILE_CONSTANT || inst->U.I.SrcReg[src].RelAddr || inst->U.I.SrcReg[src].Index >= c->Program.Constants.Count) continue; - struct rc_constant * constant = + constant = &c->Program.Constants.Constants[inst->U.I.SrcReg[src].Index]; if (constant->Type != RC_CONSTANT_IMMEDIATE) continue; - struct rc_src_register newsrc = inst->U.I.SrcReg[src]; - int have_real_reference = 0; + newsrc = inst->U.I.SrcReg[src]; + have_real_reference = 0; for(unsigned int chan = 0; chan < 4; ++chan) { unsigned int swz = GET_SWZ(newsrc.Swizzle, chan); + unsigned int newswz; + float imm; + float baseimm; + if (swz >= 4) continue; - unsigned int newswz; - float imm = constant->u.Immediate[swz]; - float baseimm = imm; + imm = constant->u.Immediate[swz]; + baseimm = imm; if (imm < 0.0) baseimm = -baseimm; @@ -475,8 +483,8 @@ static void constant_folding(struct radeon_compiler * c, struct rc_instruction * } /** - * This function returns a writemask that indicates wich components are - * read by src and also written by dst. + * If src and dst use the same register, this function returns a writemask that + * indicates wich components are read by src. Otherwise zero is returned. */ static unsigned int src_reads_dst_mask(struct rc_src_register src, struct rc_dst_register dst) @@ -563,10 +571,18 @@ static int presub_helper( * s->Inst->U.I.DstReg, because if it does we must not * remove s->Inst. */ for(i = 0; i < info->NumSrcRegs; i++) { - if(s->Inst->U.I.DstReg.WriteMask != - src_reads_dst_mask(inst->U.I.SrcReg[i], - s->Inst->U.I.DstReg)) { - continue; + unsigned int mask = src_reads_dst_mask( + inst->U.I.SrcReg[i], s->Inst->U.I.DstReg); + /* XXX We could be more aggressive here using + * presubtract. It is okay if SrcReg[i] only reads + * from some of the mask components. */ + if(s->Inst->U.I.DstReg.WriteMask != mask) { + if (s->Inst->U.I.DstReg.WriteMask & mask) { + can_remove = 0; + break; + } else { + continue; + } } if (cant_sub || !can_use_presub) { can_remove = 0; @@ -626,6 +642,21 @@ static void presub_replace_add(struct peephole_state *s, inst->U.I.SrcReg[src_index].Index = presub_opcode; } +static int is_presub_candidate(struct rc_instruction * inst) +{ + const struct rc_opcode_info * info = rc_get_opcode_info(inst->U.I.Opcode); + unsigned int i; + + if (inst->U.I.PreSub.Opcode != RC_PRESUB_NONE || inst->U.I.SaturateMode) + return 0; + + for(i = 0; i < info->NumSrcRegs; i++) { + if (src_reads_dst_mask(inst->U.I.SrcReg[i], inst->U.I.DstReg)) + return 0; + } + return 1; +} + static int peephole_add_presub_add( struct radeon_compiler * c, struct rc_instruction * inst_add) @@ -635,10 +666,7 @@ static int peephole_add_presub_add( unsigned int i; struct peephole_state s; - if (inst_add->U.I.PreSub.Opcode != RC_PRESUB_NONE) - return 0; - - if (inst_add->U.I.SaturateMode) + if (!is_presub_candidate(inst_add)) return 0; if (inst_add->U.I.SrcReg[0].Swizzle != inst_add->U.I.SrcReg[1].Swizzle) @@ -705,10 +733,7 @@ static int peephole_add_presub_inv( unsigned int i, swz, mask; struct peephole_state s; - if (inst_add->U.I.PreSub.Opcode != RC_PRESUB_NONE) - return 0; - - if (inst_add->U.I.SaturateMode) + if (!is_presub_candidate(inst_add)) return 0; mask = inst_add->U.I.DstReg.WriteMask; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c index c73845512f..91524f5ec6 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c @@ -322,12 +322,13 @@ void rc_pair_regalloc_inputs_only(struct radeon_compiler *cc, void *user) { struct r300_fragment_program_compiler *c = (struct r300_fragment_program_compiler*)cc; struct regalloc_state s; + int temp_reg_offset; compute_live_intervals(cc, &s); c->AllocateHwInputs(c, &alloc_input, &s); - int temp_reg_offset = 0; + temp_reg_offset = 0; for (unsigned i = 0; i < RC_REGISTER_MAX_INDEX; i++) { if (s.Input[i].Allocated && temp_reg_offset <= s.Input[i].Index) temp_reg_offset = s.Input[i].Index + 1; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c index 5269d65985..bfe3553460 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c @@ -237,11 +237,12 @@ static void commit_alu_instruction(struct schedule_state * s, struct schedule_in static void emit_all_tex(struct schedule_state * s, struct rc_instruction * before) { struct schedule_instruction *readytex; + struct rc_instruction * inst_begin; assert(s->ReadyTEX); /* Node marker for R300 */ - struct rc_instruction * inst_begin = rc_insert_new_instruction(s->C, before->Prev); + inst_begin = rc_insert_new_instruction(s->C, before->Prev); inst_begin->U.I.Opcode = RC_OPCODE_BEGIN_TEX; /* Link texture instructions back in */ @@ -280,6 +281,8 @@ static int destructive_merge_instructions( struct rc_pair_instruction * alpha) { const struct rc_opcode_info * opcode; + const struct rc_opcode_info * rgb_info; + assert(rgb->Alpha.Opcode == RC_OPCODE_NOP); assert(alpha->RGB.Opcode == RC_OPCODE_NOP); @@ -288,8 +291,7 @@ static int destructive_merge_instructions( * src1. */ /* Merge the rgb presubtract registers. */ - const struct rc_opcode_info * rgb_info = - rc_get_opcode_info(rgb->RGB.Opcode); + rgb_info = rc_get_opcode_info(rgb->RGB.Opcode); if (alpha->RGB.Src[RC_PAIR_PRESUB_SRC].Used) { unsigned int srcp_src; unsigned int srcp_regs; @@ -301,9 +303,9 @@ static int destructive_merge_instructions( unsigned int arg; int free_source; unsigned int one_way = 0; - struct radeon_pair_instruction_source srcp = + struct rc_pair_instruction_source srcp = alpha->RGB.Src[srcp_src]; - struct radeon_pair_instruction_source temp; + struct rc_pair_instruction_source temp; /* 2nd arg of 1 means this is an rgb source. * 3rd arg of 0 means this is not an alpha source. */ free_source = rc_pair_alloc_source(rgb, 1, 0, @@ -366,9 +368,9 @@ static int destructive_merge_instructions( unsigned int arg; int free_source; unsigned int one_way = 0; - struct radeon_pair_instruction_source srcp = + struct rc_pair_instruction_source srcp = alpha->Alpha.Src[srcp_src]; - struct radeon_pair_instruction_source temp; + struct rc_pair_instruction_source temp; /* 2nd arg of 0 means this is not an rgb source. * 3rd arg of 1 means this is an alpha source. */ free_source = rc_pair_alloc_source(rgb, 0, 1, @@ -424,6 +426,7 @@ static int destructive_merge_instructions( unsigned int oldsrc = alpha->Alpha.Arg[arg].Source; rc_register_file file = 0; unsigned int index = 0; + int source; if (alpha->Alpha.Arg[arg].Swizzle < 3) { srcrgb = 1; @@ -435,7 +438,7 @@ static int destructive_merge_instructions( index = alpha->Alpha.Src[oldsrc].Index; } - int source = rc_pair_alloc_source(rgb, srcrgb, srcalpha, file, index); + source = rc_pair_alloc_source(rgb, srcrgb, srcalpha, file, index); if (source < 0) return 0; @@ -475,6 +478,12 @@ static int merge_instructions(struct rc_pair_instruction * rgb, struct rc_pair_i { struct rc_pair_instruction backup; + /*Instructions can't write output registers and ALU result at the + * same time. */ + if ((rgb->WriteALUResult && alpha->Alpha.OutputWriteMask) + || (rgb->RGB.OutputWriteMask && alpha->WriteALUResult)) { + return 0; + } memcpy(&backup, rgb, sizeof(struct rc_pair_instruction)); if (destructive_merge_instructions(rgb, alpha)) @@ -597,6 +606,7 @@ static void scan_read(void * data, struct rc_instruction * inst, { struct schedule_state * s = data; struct reg_value * v = get_reg_value(s, file, index, chan); + struct reg_value_reader * reader; if (!v) return; @@ -610,7 +620,7 @@ static void scan_read(void * data, struct rc_instruction * inst, DBG("%i: read %i[%i] chan %i\n", s->Current->Instruction->IP, file, index, chan); - struct reg_value_reader * reader = memory_pool_malloc(&s->C->Pool, sizeof(*reader)); + reader = memory_pool_malloc(&s->C->Pool, sizeof(*reader)); reader->Reader = s->Current; reader->Next = v->Readers; v->Readers = reader; @@ -630,13 +640,14 @@ static void scan_write(void * data, struct rc_instruction * inst, { struct schedule_state * s = data; struct reg_value ** pv = get_reg_valuep(s, file, index, chan); + struct reg_value * newv; if (!pv) return; DBG("%i: write %i[%i] chan %i\n", s->Current->Instruction->IP, file, index, chan); - struct reg_value * newv = memory_pool_malloc(&s->C->Pool, sizeof(*newv)); + newv = memory_pool_malloc(&s->C->Pool, sizeof(*newv)); memset(newv, 0, sizeof(*newv)); newv->Writer = s->Current; @@ -659,12 +670,13 @@ static void schedule_block(struct r300_fragment_program_compiler * c, struct rc_instruction * begin, struct rc_instruction * end) { struct schedule_state s; + unsigned int ip; memset(&s, 0, sizeof(s)); s.C = &c->Base; /* Scan instructions for data dependencies */ - unsigned int ip = 0; + ip = 0; for(struct rc_instruction * inst = begin; inst != end; inst = inst->Next) { s.Current = memory_pool_malloc(&c->Base.Pool, sizeof(*s.Current)); memset(s.Current, 0, sizeof(struct schedule_instruction)); @@ -716,12 +728,14 @@ void rc_pair_schedule(struct radeon_compiler *cc, void *user) struct r300_fragment_program_compiler *c = (struct r300_fragment_program_compiler*)cc; struct rc_instruction * inst = c->Base.Program.Instructions.Next; while(inst != &c->Base.Program.Instructions) { + struct rc_instruction * first; + if (is_controlflow(inst)) { inst = inst->Next; continue; } - struct rc_instruction * first = inst; + first = inst; while(inst != &c->Base.Program.Instructions && !is_controlflow(inst)) inst = inst->Next; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c index ff82584466..c549be5218 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c @@ -148,9 +148,12 @@ static void set_pair_instruction(struct r300_fragment_program_compiler *c, struct rc_pair_instruction * pair, struct rc_sub_instruction * inst) { + int needrgb, needalpha, istranscendent; + const struct rc_opcode_info * opcode; + int i; + memset(pair, 0, sizeof(struct rc_pair_instruction)); - int needrgb, needalpha, istranscendent; classify_instruction(inst, &needrgb, &needalpha, &istranscendent); if (needrgb) { @@ -167,8 +170,7 @@ static void set_pair_instruction(struct r300_fragment_program_compiler *c, pair->Alpha.Saturate = 1; } - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->Opcode); - int i; + opcode = rc_get_opcode_info(inst->Opcode); /* Presubtract handling: * We need to make sure that the values used by the presubtract @@ -330,15 +332,18 @@ void rc_pair_translate(struct radeon_compiler *cc, void *user) for(struct rc_instruction * inst = c->Base.Program.Instructions.Next; inst != &c->Base.Program.Instructions; inst = inst->Next) { + const struct rc_opcode_info * opcode; + struct rc_sub_instruction copy; + if (inst->Type != RC_INSTRUCTION_NORMAL) continue; - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); + opcode = rc_get_opcode_info(inst->U.I.Opcode); if (opcode->HasTexture || opcode->IsFlowControl || opcode->Opcode == RC_OPCODE_KIL) continue; - struct rc_sub_instruction copy = inst->U.I; + copy = inst->U.I; check_opcode_support(c, ©); diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c index 4d3e26f28c..39408845d5 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c @@ -874,13 +874,15 @@ int r300_transform_trig_simple(struct radeon_compiler* c, struct rc_instruction* inst, void* unused) { + unsigned int constants[2]; + unsigned int tempreg; + if (inst->U.I.Opcode != RC_OPCODE_COS && inst->U.I.Opcode != RC_OPCODE_SIN && inst->U.I.Opcode != RC_OPCODE_SCS) return 0; - unsigned int constants[2]; - unsigned int tempreg = rc_find_free_temporary(c); + tempreg = rc_find_free_temporary(c); sincos_constants(c, constants); @@ -918,6 +920,8 @@ int r300_transform_trig_simple(struct radeon_compiler* c, swizzle_wwww(srcreg(RC_FILE_TEMPORARY, tempreg)), constants); } else { + struct rc_dst_register dst; + emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_XY), swizzle_xxxx(inst->U.I.SrcReg[0]), swizzle_zzzz(srcreg(RC_FILE_CONSTANT, constants[1])), @@ -929,7 +933,7 @@ int r300_transform_trig_simple(struct radeon_compiler* c, swizzle_wwww(srcreg(RC_FILE_CONSTANT, constants[1])), negate(swizzle_zzzz(srcreg(RC_FILE_CONSTANT, constants[0])))); - struct rc_dst_register dst = inst->U.I.DstReg; + dst = inst->U.I.DstReg; dst.WriteMask = inst->U.I.DstReg.WriteMask & RC_MASK_X; sin_approx(c, inst, dst, @@ -988,16 +992,16 @@ int radeonTransformTrigScale(struct radeon_compiler* c, struct rc_instruction* inst, void* unused) { - if (inst->U.I.Opcode != RC_OPCODE_COS && - inst->U.I.Opcode != RC_OPCODE_SIN && - inst->U.I.Opcode != RC_OPCODE_SCS) - return 0; - static const float RCP_2PI = 0.15915494309189535; unsigned int temp; unsigned int constant; unsigned int constant_swizzle; + if (inst->U.I.Opcode != RC_OPCODE_COS && + inst->U.I.Opcode != RC_OPCODE_SIN && + inst->U.I.Opcode != RC_OPCODE_SCS) + return 0; + temp = rc_find_free_temporary(c); constant = rc_constants_add_immediate_scalar(&c->Program.Constants, RCP_2PI, &constant_swizzle); @@ -1020,6 +1024,10 @@ int r300_transform_trig_scale_vertex(struct radeon_compiler *c, struct rc_instruction *inst, void *unused) { + static const float cons[4] = {0.15915494309189535, 0.5, 6.28318530717959, -3.14159265358979}; + unsigned int temp; + unsigned int constant; + if (inst->U.I.Opcode != RC_OPCODE_COS && inst->U.I.Opcode != RC_OPCODE_SIN && inst->U.I.Opcode != RC_OPCODE_SCS) @@ -1030,10 +1038,6 @@ int r300_transform_trig_scale_vertex(struct radeon_compiler *c, * repeat(x) = frac(x / 2PI + 0.5) * 2PI - PI */ - static const float cons[4] = {0.15915494309189535, 0.5, 6.28318530717959, -3.14159265358979}; - unsigned int temp; - unsigned int constant; - temp = rc_find_free_temporary(c); constant = rc_constants_add_immediate_vec4(&c->Program.Constants, cons); diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h index e0061e454b..01cdb15424 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h @@ -55,52 +55,35 @@ struct radeon_compiler; */ #define RC_PAIR_PRESUB_SRC 3 -struct radeon_pair_instruction_source { +struct rc_pair_instruction_source { unsigned int Used:1; unsigned int File:3; unsigned int Index:RC_REGISTER_INDEX_BITS; }; -struct radeon_pair_instruction_rgb { - unsigned int Opcode:8; - unsigned int DestIndex:RC_REGISTER_INDEX_BITS; - unsigned int WriteMask:3; - unsigned int Target:2; - unsigned int OutputWriteMask:3; - unsigned int Saturate:1; - - struct radeon_pair_instruction_source Src[4]; - - struct { - unsigned int Source:2; - unsigned int Swizzle:9; - unsigned int Abs:1; - unsigned int Negate:1; - } Arg[3]; +struct rc_pair_instruction_arg { + unsigned int Source:2; + unsigned int Swizzle:9; + unsigned int Abs:1; + unsigned int Negate:1; }; -struct radeon_pair_instruction_alpha { +struct rc_pair_sub_instruction { unsigned int Opcode:8; unsigned int DestIndex:RC_REGISTER_INDEX_BITS; - unsigned int WriteMask:1; - unsigned int Target:2; - unsigned int OutputWriteMask:1; + unsigned int WriteMask:3; + unsigned int Target:2; + unsigned int OutputWriteMask:3; unsigned int DepthWriteMask:1; unsigned int Saturate:1; - struct radeon_pair_instruction_source Src[4]; - - struct { - unsigned int Source:2; - unsigned int Swizzle:3; - unsigned int Abs:1; - unsigned int Negate:1; - } Arg[3]; + struct rc_pair_instruction_source Src[4]; + struct rc_pair_instruction_arg Arg[3]; }; struct rc_pair_instruction { - struct radeon_pair_instruction_rgb RGB; - struct radeon_pair_instruction_alpha Alpha; + struct rc_pair_sub_instruction RGB; + struct rc_pair_sub_instruction Alpha; unsigned int WriteALUResult:2; unsigned int ALUResultCompare:3; @@ -108,7 +91,7 @@ struct rc_pair_instruction { }; typedef void (*rc_pair_foreach_src_fn) - (void *, struct radeon_pair_instruction_source *); + (void *, struct rc_pair_instruction_source *); typedef enum { RC_PAIR_SOURCE_NONE = 0, diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c index ddce590ee6..530afa5e08 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2010 Corbin Simpson + * Copyright (C) 2010 Marek Olšák <maraeo@gmail.com> * * All Rights Reserved. * @@ -46,31 +47,61 @@ static struct rc_src_register shadow_ambient(struct r300_fragment_program_compil return reg; } -static void lower_texture_rect(struct r300_fragment_program_compiler *compiler, - struct rc_instruction *inst) +static void scale_texcoords(struct r300_fragment_program_compiler *compiler, + struct rc_instruction *inst, + unsigned state_constant) { - struct rc_instruction *inst_rect; + struct rc_instruction *inst_mov; + unsigned temp = rc_find_free_temporary(&compiler->Base); - if (inst->U.I.TexSrcTarget == RC_TEXTURE_RECT || - compiler->state.unit[inst->U.I.TexSrcUnit].non_normalized_coords) { - inst_rect = rc_insert_new_instruction(&compiler->Base, inst->Prev); + inst_mov = rc_insert_new_instruction(&compiler->Base, inst->Prev); - inst_rect->U.I.Opcode = RC_OPCODE_MUL; - inst_rect->U.I.DstReg.File = RC_FILE_TEMPORARY; - inst_rect->U.I.DstReg.Index = temp; - inst_rect->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; - inst_rect->U.I.SrcReg[1].File = RC_FILE_CONSTANT; - inst_rect->U.I.SrcReg[1].Index = - rc_constants_add_state(&compiler->Base.Program.Constants, - RC_STATE_R300_TEXRECT_FACTOR, inst->U.I.TexSrcUnit); + inst_mov->U.I.Opcode = RC_OPCODE_MUL; + inst_mov->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_mov->U.I.DstReg.Index = temp; + inst_mov->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + inst_mov->U.I.SrcReg[1].File = RC_FILE_CONSTANT; + inst_mov->U.I.SrcReg[1].Index = + rc_constants_add_state(&compiler->Base.Program.Constants, + state_constant, inst->U.I.TexSrcUnit); - reset_srcreg(&inst->U.I.SrcReg[0]); - inst->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; - inst->U.I.SrcReg[0].Index = temp; + reset_srcreg(&inst->U.I.SrcReg[0]); + inst->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; + inst->U.I.SrcReg[0].Index = temp; +} - inst->U.I.TexSrcTarget = RC_TEXTURE_2D; - } +static void projective_divide(struct r300_fragment_program_compiler *compiler, + struct rc_instruction *inst) +{ + struct rc_instruction *inst_mul, *inst_rcp; + + unsigned temp = rc_find_free_temporary(&compiler->Base); + + inst_rcp = rc_insert_new_instruction(&compiler->Base, inst->Prev); + inst_rcp->U.I.Opcode = RC_OPCODE_RCP; + inst_rcp->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_rcp->U.I.DstReg.Index = temp; + inst_rcp->U.I.DstReg.WriteMask = RC_MASK_W; + inst_rcp->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + /* Because the input can be arbitrarily swizzled, + * read the component mapped to W. */ + inst_rcp->U.I.SrcReg[0].Swizzle = + RC_MAKE_SWIZZLE_SMEAR(GET_SWZ(inst->U.I.SrcReg[0].Swizzle, 3)); + + inst_mul = rc_insert_new_instruction(&compiler->Base, inst->Prev); + inst_mul->U.I.Opcode = RC_OPCODE_MUL; + inst_mul->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_mul->U.I.DstReg.Index = temp; + inst_mul->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + inst_mul->U.I.SrcReg[1].File = RC_FILE_TEMPORARY; + inst_mul->U.I.SrcReg[1].Index = temp; + inst_mul->U.I.SrcReg[1].Swizzle = RC_SWIZZLE_WWWW; + + reset_srcreg(&inst->U.I.SrcReg[0]); + inst->U.I.Opcode = RC_OPCODE_TEX; + inst->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; + inst->U.I.SrcReg[0].Index = temp; } /** @@ -88,6 +119,9 @@ int radeonTransformTEX( { struct r300_fragment_program_compiler *compiler = (struct r300_fragment_program_compiler*)data; + rc_wrap_mode wrapmode = compiler->state.unit[inst->U.I.TexSrcUnit].wrap_mode; + int is_rect = inst->U.I.TexSrcTarget == RC_TEXTURE_RECT || + compiler->state.unit[inst->U.I.TexSrcUnit].non_normalized_coords; if (inst->U.I.Opcode != RC_OPCODE_TEX && inst->U.I.Opcode != RC_OPCODE_TXB && @@ -141,16 +175,18 @@ int radeonTransformTEX( inst_rcp->U.I.DstReg.Index = tmp_recip_w; inst_rcp->U.I.DstReg.WriteMask = RC_MASK_W; inst_rcp->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; - inst_rcp->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_WWWW; + inst_rcp->U.I.SrcReg[0].Swizzle = + RC_MAKE_SWIZZLE_SMEAR(GET_SWZ(inst->U.I.SrcReg[0].Swizzle, 3)); } - /* Perspective-divide r by W (if it's TXP) and add the texture sample (see below). */ + /* Perspective-divide Z by W (if it's TXP) and add the texture sample (see below). */ tmp_sum = rc_find_free_temporary(c); inst_mad = rc_insert_new_instruction(c, inst_rcp ? inst_rcp : inst); inst_mad->U.I.DstReg.File = RC_FILE_TEMPORARY; inst_mad->U.I.DstReg.Index = tmp_sum; inst_mad->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; - inst_mad->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_ZZZZ; + inst_mad->U.I.SrcReg[0].Swizzle = + RC_MAKE_SWIZZLE_SMEAR(GET_SWZ(inst->U.I.SrcReg[0].Swizzle, 2)); if (inst->U.I.Opcode == RC_OPCODE_TXP) { inst_mad->U.I.Opcode = RC_OPCODE_MAD; inst_mad->U.I.SrcReg[1].File = RC_FILE_TEMPORARY; @@ -206,11 +242,22 @@ int radeonTransformTEX( } } - /* Texture wrap modes don't work on NPOT textures or texrects. - * - * The game plan is simple. We have two flags, fake_npot and - * non_normalized_coords, as well as a tex target. The RECT tex target - * will make the emitted code use non-scaled texcoords. + /* R300 cannot sample from rectangles and the wrap mode fallback needs + * normalized coordinates anyway. */ + if (inst->U.I.Opcode != RC_OPCODE_KIL && + is_rect && (!c->is_r500 || wrapmode != RC_WRAP_NONE)) { + scale_texcoords(compiler, inst, RC_STATE_R300_TEXRECT_FACTOR); + inst->U.I.TexSrcTarget = RC_TEXTURE_2D; + } + + /* Divide by W if needed. */ + if (inst->U.I.Opcode == RC_OPCODE_TXP && + (wrapmode == RC_WRAP_REPEAT || wrapmode == RC_WRAP_MIRRORED_REPEAT || + compiler->state.unit[inst->U.I.TexSrcUnit].clamp_and_scale_before_fetch)) { + projective_divide(compiler, inst); + } + + /* Texture wrap modes don't work on NPOT textures. * * Non-wrapped/clamped texcoords with NPOT are free in HW. Repeat and * mirroring are not. If we need to repeat, we do: @@ -235,128 +282,140 @@ int radeonTransformTEX( * ~ C & M. ;) */ if (inst->U.I.Opcode != RC_OPCODE_KIL && - (inst->U.I.TexSrcTarget == RC_TEXTURE_RECT || - compiler->state.unit[inst->U.I.TexSrcUnit].fake_npot || - compiler->state.unit[inst->U.I.TexSrcUnit].non_normalized_coords)) { - rc_wrap_mode wrapmode = compiler->state.unit[inst->U.I.TexSrcUnit].wrap_mode; - - /* R300 cannot sample from rectangles. */ - if (!c->is_r500) { - lower_texture_rect(compiler, inst); - } - - if (compiler->state.unit[inst->U.I.TexSrcUnit].fake_npot && - wrapmode != RC_WRAP_NONE) { + wrapmode != RC_WRAP_NONE) { + struct rc_instruction *inst_mov; + unsigned temp = rc_find_free_temporary(c); + + if (wrapmode == RC_WRAP_REPEAT) { + /* Both instructions will be paired up. */ + struct rc_instruction *inst_frc = rc_insert_new_instruction(c, inst->Prev); + + inst_frc->U.I.Opcode = RC_OPCODE_FRC; + inst_frc->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_frc->U.I.DstReg.Index = temp; + inst_frc->U.I.DstReg.WriteMask = RC_MASK_XYZ; + inst_frc->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + } else if (wrapmode == RC_WRAP_MIRRORED_REPEAT) { + /* + * Function: + * f(v) = 1 - abs(frac(v * 0.5) * 2 - 1) + * + * Code: + * MUL temp, src0, 0.5 + * FRC temp, temp + * MAD temp, temp, 2, -1 + * ADD temp, 1, -abs(temp) + */ + + struct rc_instruction *inst_mul, *inst_frc, *inst_mad, *inst_add; + unsigned two, two_swizzle; + + inst_mul = rc_insert_new_instruction(c, inst->Prev); + + inst_mul->U.I.Opcode = RC_OPCODE_MUL; + inst_mul->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_mul->U.I.DstReg.Index = temp; + inst_mul->U.I.DstReg.WriteMask = RC_MASK_XYZ; + inst_mul->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + inst_mul->U.I.SrcReg[1].Swizzle = RC_SWIZZLE_HHHH; + + inst_frc = rc_insert_new_instruction(c, inst->Prev); + + inst_frc->U.I.Opcode = RC_OPCODE_FRC; + inst_frc->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_frc->U.I.DstReg.Index = temp; + inst_frc->U.I.DstReg.WriteMask = RC_MASK_XYZ; + inst_frc->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; + inst_frc->U.I.SrcReg[0].Index = temp; + inst_frc->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_XYZ0; + + two = rc_constants_add_immediate_scalar(&c->Program.Constants, 2, &two_swizzle); + inst_mad = rc_insert_new_instruction(c, inst->Prev); + + inst_mad->U.I.Opcode = RC_OPCODE_MAD; + inst_mad->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_mad->U.I.DstReg.Index = temp; + inst_mad->U.I.DstReg.WriteMask = RC_MASK_XYZ; + inst_mad->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; + inst_mad->U.I.SrcReg[0].Index = temp; + inst_mad->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_XYZ0; + inst_mad->U.I.SrcReg[1].File = RC_FILE_CONSTANT; + inst_mad->U.I.SrcReg[1].Index = two; + inst_mad->U.I.SrcReg[1].Swizzle = two_swizzle; + inst_mad->U.I.SrcReg[2].Swizzle = RC_SWIZZLE_1111; + inst_mad->U.I.SrcReg[2].Negate = RC_MASK_XYZ; + + inst_add = rc_insert_new_instruction(c, inst->Prev); + + inst_add->U.I.Opcode = RC_OPCODE_ADD; + inst_add->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_add->U.I.DstReg.Index = temp; + inst_add->U.I.DstReg.WriteMask = RC_MASK_XYZ; + inst_add->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_1111; + inst_add->U.I.SrcReg[1].File = RC_FILE_TEMPORARY; + inst_add->U.I.SrcReg[1].Index = temp; + inst_add->U.I.SrcReg[1].Swizzle = RC_SWIZZLE_XYZ0; + inst_add->U.I.SrcReg[1].Abs = 1; + inst_add->U.I.SrcReg[1].Negate = RC_MASK_XYZ; + } else if (wrapmode == RC_WRAP_MIRRORED_CLAMP) { + /* + * Mirrored clamp modes are bloody simple, we just use abs + * to mirror [0, 1] into [-1, 0]. This works for + * all modes i.e. CLAMP, CLAMP_TO_EDGE, and CLAMP_TO_BORDER. + */ struct rc_instruction *inst_mov; - unsigned temp = rc_find_free_temporary(c); - - /* For NPOT fallback, we need normalized coordinates anyway. */ - if (c->is_r500) { - lower_texture_rect(compiler, inst); - } - - if (wrapmode == RC_WRAP_REPEAT) { - /* Both instructions will be paired up. */ - struct rc_instruction *inst_frc = rc_insert_new_instruction(c, inst->Prev); - - inst_frc->U.I.Opcode = RC_OPCODE_FRC; - inst_frc->U.I.DstReg.File = RC_FILE_TEMPORARY; - inst_frc->U.I.DstReg.Index = temp; - inst_frc->U.I.DstReg.WriteMask = RC_MASK_XYZ; - inst_frc->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; - } else if (wrapmode == RC_WRAP_MIRRORED_REPEAT) { - /* - * Function: - * f(v) = 1 - abs(frac(v * 0.5) * 2 - 1) - * - * Code: - * MUL temp, src0, 0.5 - * FRC temp, temp - * MAD temp, temp, 2, -1 - * ADD temp, 1, -abs(temp) - */ - - struct rc_instruction *inst_mul, *inst_frc, *inst_mad, *inst_add; - unsigned two, two_swizzle; - - inst_mul = rc_insert_new_instruction(c, inst->Prev); - - inst_mul->U.I.Opcode = RC_OPCODE_MUL; - inst_mul->U.I.DstReg.File = RC_FILE_TEMPORARY; - inst_mul->U.I.DstReg.Index = temp; - inst_mul->U.I.DstReg.WriteMask = RC_MASK_XYZ; - inst_mul->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; - inst_mul->U.I.SrcReg[1].Swizzle = RC_SWIZZLE_HHHH; - - inst_frc = rc_insert_new_instruction(c, inst->Prev); - - inst_frc->U.I.Opcode = RC_OPCODE_FRC; - inst_frc->U.I.DstReg.File = RC_FILE_TEMPORARY; - inst_frc->U.I.DstReg.Index = temp; - inst_frc->U.I.DstReg.WriteMask = RC_MASK_XYZ; - inst_frc->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; - inst_frc->U.I.SrcReg[0].Index = temp; - inst_frc->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_XYZ0; - - two = rc_constants_add_immediate_scalar(&c->Program.Constants, 2, &two_swizzle); - inst_mad = rc_insert_new_instruction(c, inst->Prev); - - inst_mad->U.I.Opcode = RC_OPCODE_MAD; - inst_mad->U.I.DstReg.File = RC_FILE_TEMPORARY; - inst_mad->U.I.DstReg.Index = temp; - inst_mad->U.I.DstReg.WriteMask = RC_MASK_XYZ; - inst_mad->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; - inst_mad->U.I.SrcReg[0].Index = temp; - inst_mad->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_XYZ0; - inst_mad->U.I.SrcReg[1].File = RC_FILE_CONSTANT; - inst_mad->U.I.SrcReg[1].Index = two; - inst_mad->U.I.SrcReg[1].Swizzle = two_swizzle; - inst_mad->U.I.SrcReg[2].Swizzle = RC_SWIZZLE_1111; - inst_mad->U.I.SrcReg[2].Negate = RC_MASK_XYZ; - - inst_add = rc_insert_new_instruction(c, inst->Prev); - - inst_add->U.I.Opcode = RC_OPCODE_ADD; - inst_add->U.I.DstReg.File = RC_FILE_TEMPORARY; - inst_add->U.I.DstReg.Index = temp; - inst_add->U.I.DstReg.WriteMask = RC_MASK_XYZ; - inst_add->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_1111; - inst_add->U.I.SrcReg[1].File = RC_FILE_TEMPORARY; - inst_add->U.I.SrcReg[1].Index = temp; - inst_add->U.I.SrcReg[1].Swizzle = RC_SWIZZLE_XYZ0; - inst_add->U.I.SrcReg[1].Abs = 1; - inst_add->U.I.SrcReg[1].Negate = RC_MASK_XYZ; - } else if (wrapmode == RC_WRAP_MIRRORED_CLAMP) { - /* - * Mirrored clamp modes are bloody simple, we just use abs - * to mirror [0, 1] into [-1, 0]. This works for - * all modes i.e. CLAMP, CLAMP_TO_EDGE, and CLAMP_TO_BORDER. - */ - struct rc_instruction *inst_mov; - - inst_mov = rc_insert_new_instruction(c, inst->Prev); - - inst_mov->U.I.Opcode = RC_OPCODE_MOV; - inst_mov->U.I.DstReg.File = RC_FILE_TEMPORARY; - inst_mov->U.I.DstReg.Index = temp; - inst_mov->U.I.DstReg.WriteMask = RC_MASK_XYZ; - inst_mov->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; - inst_mov->U.I.SrcReg[0].Abs = 1; - } - /* Preserve W for TXP/TXB. */ inst_mov = rc_insert_new_instruction(c, inst->Prev); inst_mov->U.I.Opcode = RC_OPCODE_MOV; inst_mov->U.I.DstReg.File = RC_FILE_TEMPORARY; inst_mov->U.I.DstReg.Index = temp; - inst_mov->U.I.DstReg.WriteMask = RC_MASK_W; + inst_mov->U.I.DstReg.WriteMask = RC_MASK_XYZ; inst_mov->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; - - reset_srcreg(&inst->U.I.SrcReg[0]); - inst->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; - inst->U.I.SrcReg[0].Index = temp; + inst_mov->U.I.SrcReg[0].Abs = 1; } + + /* Preserve W for TXP/TXB. */ + inst_mov = rc_insert_new_instruction(c, inst->Prev); + + inst_mov->U.I.Opcode = RC_OPCODE_MOV; + inst_mov->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_mov->U.I.DstReg.Index = temp; + inst_mov->U.I.DstReg.WriteMask = RC_MASK_W; + inst_mov->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + + reset_srcreg(&inst->U.I.SrcReg[0]); + inst->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; + inst->U.I.SrcReg[0].Index = temp; + } + + if (inst->U.I.Opcode != RC_OPCODE_KIL && + compiler->state.unit[inst->U.I.TexSrcUnit].clamp_and_scale_before_fetch) { + struct rc_instruction *inst_mov; + unsigned temp = rc_find_free_temporary(c); + + /* Saturate XYZ. */ + inst_mov = rc_insert_new_instruction(c, inst->Prev); + inst_mov->U.I.Opcode = RC_OPCODE_MOV; + inst_mov->U.I.SaturateMode = RC_SATURATE_ZERO_ONE; + inst_mov->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_mov->U.I.DstReg.Index = temp; + inst_mov->U.I.DstReg.WriteMask = RC_MASK_XYZ; + inst_mov->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + + /* Copy W. */ + inst_mov = rc_insert_new_instruction(c, inst->Prev); + inst_mov->U.I.Opcode = RC_OPCODE_MOV; + inst_mov->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_mov->U.I.DstReg.Index = temp; + inst_mov->U.I.DstReg.WriteMask = RC_MASK_W; + inst_mov->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + + reset_srcreg(&inst->U.I.SrcReg[0]); + inst->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; + inst->U.I.SrcReg[0].Index = temp; + + scale_texcoords(compiler, inst, RC_STATE_R300_TEXSCALE_FACTOR); } /* Cannot write texture to output registers (all chips) or with masks (non-r500) */ diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c b/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c index d111319d3d..d6c808ad81 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c @@ -28,107 +28,105 @@ #include "radeon_remove_constants.h" #include "radeon_dataflow.h" +struct mark_used_data { + unsigned char * const_used; + unsigned * has_rel_addr; +}; + static void remap_regs(void * userdata, struct rc_instruction * inst, rc_register_file * pfile, unsigned int * pindex) { - unsigned *inv_remap_table = userdata; + unsigned *inv_remap_table = userdata; + + if (*pfile == RC_FILE_CONSTANT) { + *pindex = inv_remap_table[*pindex]; + } +} + +static void mark_used(void * userdata, struct rc_instruction * inst, + struct rc_src_register * src) +{ + struct mark_used_data * d = userdata; - if (*pfile == RC_FILE_CONSTANT) { - *pindex = inv_remap_table[*pindex]; - } + if (src->File == RC_FILE_CONSTANT) { + if (src->RelAddr) { + *d->has_rel_addr = 1; + } else { + d->const_used[src->Index] = 1; + } + } } void rc_remove_unused_constants(struct radeon_compiler *c, void *user) { unsigned **out_remap_table = (unsigned**)user; - unsigned char *const_used; - unsigned *remap_table; - unsigned *inv_remap_table; - unsigned has_rel_addr = 0; - unsigned is_identity = 1; + unsigned char *const_used; + unsigned *remap_table; + unsigned *inv_remap_table; + unsigned has_rel_addr = 0; + unsigned is_identity = 1; unsigned are_externals_remapped = 0; - struct rc_constant *constants = c->Program.Constants.Constants; + struct rc_constant *constants = c->Program.Constants.Constants; + struct mark_used_data d; + unsigned new_count; + + if (!c->Program.Constants.Count) { + *out_remap_table = NULL; + return; + } - if (!c->Program.Constants.Count) { - *out_remap_table = NULL; - return; - } + const_used = malloc(c->Program.Constants.Count); + memset(const_used, 0, c->Program.Constants.Count); - const_used = malloc(c->Program.Constants.Count); - memset(const_used, 0, c->Program.Constants.Count); + d.const_used = const_used; + d.has_rel_addr = &has_rel_addr; /* Pass 1: Mark used constants. */ - for (struct rc_instruction *inst = c->Program.Instructions.Next; - inst != &c->Program.Instructions; inst = inst->Next) { - const struct rc_opcode_info *opcode = rc_get_opcode_info(inst->U.I.Opcode); - - /* XXX: This loop and the if statement after it should be - * replaced by a call to one of the rc_for_all_reads_* functions. - * The reason it does not use one of those functions now is - * because none of them have RelAddr as an argument. */ - for (unsigned i = 0; i < opcode->NumSrcRegs; i++) { - if (inst->U.I.SrcReg[i].File == RC_FILE_CONSTANT) { - if (inst->U.I.SrcReg[i].RelAddr) { - has_rel_addr = 1; - } else { - const_used[inst->U.I.SrcReg[i].Index] = 1; - } - } - } - if (inst->U.I.PreSub.Opcode != RC_PRESUB_NONE) { - unsigned int i; - unsigned int srcp_regs = rc_presubtract_src_reg_count( - inst->U.I.PreSub.Opcode); - for( i = 0; i < srcp_regs; i++) { - if (inst->U.I.PreSub.SrcReg[i].File == - RC_FILE_CONSTANT) { - const_used[ - inst->U.I.PreSub.SrcReg[i].Index] = 1; - } - } - } - } + for (struct rc_instruction *inst = c->Program.Instructions.Next; + inst != &c->Program.Instructions; inst = inst->Next) { + rc_for_all_reads_src(inst, mark_used, &d); + } - /* Pass 2: If there is relative addressing, mark all externals as used. */ - if (has_rel_addr) { - for (unsigned i = 0; i < c->Program.Constants.Count; i++) - if (constants[i].Type == RC_CONSTANT_EXTERNAL) - const_used[i] = 1; - } + /* Pass 2: If there is relative addressing, mark all externals as used. */ + if (has_rel_addr) { + for (unsigned i = 0; i < c->Program.Constants.Count; i++) + if (constants[i].Type == RC_CONSTANT_EXTERNAL) + const_used[i] = 1; + } - /* Pass 3: Make the remapping table and remap constants. + /* Pass 3: Make the remapping table and remap constants. * This pass removes unused constants simply by overwriting them by other constants. */ - remap_table = malloc(c->Program.Constants.Count * sizeof(unsigned)); - inv_remap_table = malloc(c->Program.Constants.Count * sizeof(unsigned)); - unsigned new_count = 0; + remap_table = malloc(c->Program.Constants.Count * sizeof(unsigned)); + inv_remap_table = malloc(c->Program.Constants.Count * sizeof(unsigned)); + new_count = 0; - for (unsigned i = 0; i < c->Program.Constants.Count; i++) { - if (const_used[i]) { - remap_table[new_count] = i; - inv_remap_table[i] = new_count; + for (unsigned i = 0; i < c->Program.Constants.Count; i++) { + if (const_used[i]) { + remap_table[new_count] = i; + inv_remap_table[i] = new_count; - if (i != new_count) { + if (i != new_count) { if (constants[i].Type == RC_CONSTANT_EXTERNAL) are_externals_remapped = 1; constants[new_count] = constants[i]; - is_identity = 0; - } - new_count++; - } - } + is_identity = 0; + } + new_count++; + } + } /* is_identity ==> new_count == old_count * !is_identity ==> new_count < old_count */ assert( is_identity || new_count < c->Program.Constants.Count); assert(!(has_rel_addr && are_externals_remapped)); - /* Pass 4: Redirect reads of all constants to their new locations. */ - if (!is_identity) { - for (struct rc_instruction *inst = c->Program.Instructions.Next; - inst != &c->Program.Instructions; inst = inst->Next) { - rc_remap_registers(inst, remap_regs, inv_remap_table); - } + /* Pass 4: Redirect reads of all constants to their new locations. */ + if (!is_identity) { + for (struct rc_instruction *inst = c->Program.Instructions.Next; + inst != &c->Program.Instructions; inst = inst->Next) { + rc_remap_registers(inst, remap_regs, inv_remap_table); + } } @@ -138,12 +136,15 @@ void rc_remove_unused_constants(struct radeon_compiler *c, void *user) c->Program.Constants.Count = new_count; if (are_externals_remapped) { - *out_remap_table = remap_table; - } else { - *out_remap_table = NULL; - free(remap_table); - } - - free(const_used); - free(inv_remap_table); + *out_remap_table = remap_table; + } else { + *out_remap_table = NULL; + free(remap_table); + } + + free(const_used); + free(inv_remap_table); + + if (c->Debug) + rc_constants_print(&c->Program.Constants); } diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_rename_regs.c b/src/mesa/drivers/dri/r300/compiler/radeon_rename_regs.c index 31d25f9ab8..60e228be5b 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_rename_regs.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_rename_regs.c @@ -104,13 +104,14 @@ void rc_rename_regs(struct radeon_compiler *c, void *user) inst != &c->Program.Instructions; inst = inst->Next) { const struct rc_opcode_info * info; + unsigned int old_index, temp_index; + struct rc_dst_register * dst; if(inst->Type != RC_INSTRUCTION_NORMAL) { rc_error(c, "%s only works with normal instructions.", __FUNCTION__); return; } - unsigned int old_index, temp_index; - struct rc_dst_register * dst = &inst->U.I.DstReg; + dst = &inst->U.I.DstReg; info = rc_get_opcode_info(inst->U.I.Opcode); if(!info->HasDstReg || dst->File != RC_FILE_TEMPORARY) { continue; diff --git a/src/mesa/drivers/dri/r300/r300_blit.c b/src/mesa/drivers/dri/r300/r300_blit.c index 74aef765e3..9fd8e8fde5 100644 --- a/src/mesa/drivers/dri/r300/r300_blit.c +++ b/src/mesa/drivers/dri/r300/r300_blit.c @@ -569,7 +569,7 @@ unsigned r300_check_blit(gl_format dst_format) * @param[in] height region height * @param[in] flip_y set if y coords of the source image need to be flipped */ -unsigned r300_blit(GLcontext *ctx, +unsigned r300_blit(struct gl_context *ctx, struct radeon_bo *src_bo, intptr_t src_offset, gl_format src_mesaformat, diff --git a/src/mesa/drivers/dri/r300/r300_blit.h b/src/mesa/drivers/dri/r300/r300_blit.h index 39b157a57b..286dbe1856 100644 --- a/src/mesa/drivers/dri/r300/r300_blit.h +++ b/src/mesa/drivers/dri/r300/r300_blit.h @@ -32,7 +32,7 @@ void r300_blit_init(struct r300_context *r300); unsigned r300_check_blit(gl_format mesa_format); -unsigned r300_blit(GLcontext *ctx, +unsigned r300_blit(struct gl_context *ctx, struct radeon_bo *src_bo, intptr_t src_offset, gl_format src_mesaformat, diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index c40802aec6..8a2f5ce021 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -69,7 +69,7 @@ static unsigned packet0_count(r300ContextPtr r300, uint32_t *pkt) #define vpu_count(ptr) (((drm_r300_cmd_header_t*)(ptr))->vpu.count) #define r500fp_count(ptr) (((drm_r300_cmd_header_t*)(ptr))->r500fp.count) -static int check_vpu(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_vpu(struct gl_context *ctx, struct radeon_state_atom *atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); int cnt; @@ -83,7 +83,7 @@ static int check_vpu(GLcontext *ctx, struct radeon_state_atom *atom) return cnt ? (cnt * 4) + extra : 0; } -static int check_vpp(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_vpp(struct gl_context *ctx, struct radeon_state_atom *atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); int cnt; @@ -114,7 +114,7 @@ void r300_emit_vpu(struct r300_context *r300, END_BATCH(); } -static void emit_vpu_state(GLcontext *ctx, struct radeon_state_atom * atom) +static void emit_vpu_state(struct gl_context *ctx, struct radeon_state_atom * atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); drm_r300_cmd_header_t cmd; @@ -126,7 +126,7 @@ static void emit_vpu_state(GLcontext *ctx, struct radeon_state_atom * atom) r300_emit_vpu(r300, &atom->cmd[1], vpu_count(atom->cmd) * 4, addr); } -static void emit_vpp_state(GLcontext *ctx, struct radeon_state_atom * atom) +static void emit_vpp_state(struct gl_context *ctx, struct radeon_state_atom * atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); drm_r300_cmd_header_t cmd; @@ -158,7 +158,7 @@ void r500_emit_fp(struct r300_context *r300, END_BATCH(); } -static void emit_r500fp_atom(GLcontext *ctx, struct radeon_state_atom * atom) +static void emit_r500fp_atom(struct gl_context *ctx, struct radeon_state_atom * atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); drm_r300_cmd_header_t cmd; @@ -179,7 +179,7 @@ static void emit_r500fp_atom(GLcontext *ctx, struct radeon_state_atom * atom) r500_emit_fp(r300, &atom->cmd[1], count, addr, type, clamp); } -static int check_tex_offsets(GLcontext *ctx, struct radeon_state_atom * atom) +static int check_tex_offsets(struct gl_context *ctx, struct radeon_state_atom * atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); int numtmus = packet0_count(r300, r300->hw.tex.offset.cmd); @@ -200,7 +200,7 @@ static int check_tex_offsets(GLcontext *ctx, struct radeon_state_atom * atom) return dw; } -static void emit_tex_offsets(GLcontext *ctx, struct radeon_state_atom * atom) +static void emit_tex_offsets(struct gl_context *ctx, struct radeon_state_atom * atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); BATCH_LOCALS(&r300->radeon); @@ -249,7 +249,7 @@ static void emit_tex_offsets(GLcontext *ctx, struct radeon_state_atom * atom) } } -void r300_emit_scissor(GLcontext *ctx) +void r300_emit_scissor(struct gl_context *ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); BATCH_LOCALS(&r300->radeon); @@ -287,7 +287,7 @@ void r300_emit_scissor(GLcontext *ctx) OUT_BATCH((x2 << R300_SCISSORS_X_SHIFT)|(y2 << R300_SCISSORS_Y_SHIFT)); END_BATCH(); } -static int check_cb_offset(GLcontext *ctx, struct radeon_state_atom * atom) +static int check_cb_offset(struct gl_context *ctx, struct radeon_state_atom * atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); uint32_t dw = 6 + 3 + 16; @@ -411,7 +411,7 @@ void r300_emit_cb_setup(struct r300_context *r300, END_BATCH(); } -static void emit_cb_offset_atom(GLcontext *ctx, struct radeon_state_atom * atom) +static void emit_cb_offset_atom(struct gl_context *ctx, struct radeon_state_atom * atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); struct radeon_renderbuffer *rrb; @@ -433,7 +433,7 @@ static void emit_cb_offset_atom(GLcontext *ctx, struct radeon_state_atom * atom) } } -static int check_zb_offset(GLcontext *ctx, struct radeon_state_atom * atom) +static int check_zb_offset(struct gl_context *ctx, struct radeon_state_atom * atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); uint32_t dw; @@ -443,7 +443,7 @@ static int check_zb_offset(GLcontext *ctx, struct radeon_state_atom * atom) return dw; } -static void emit_zb_offset(GLcontext *ctx, struct radeon_state_atom * atom) +static void emit_zb_offset(struct gl_context *ctx, struct radeon_state_atom * atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); BATCH_LOCALS(&r300->radeon); @@ -476,7 +476,7 @@ static void emit_zb_offset(GLcontext *ctx, struct radeon_state_atom * atom) END_BATCH(); } -static void emit_zstencil_format(GLcontext *ctx, struct radeon_state_atom * atom) +static void emit_zstencil_format(struct gl_context *ctx, struct radeon_state_atom * atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); BATCH_LOCALS(&r300->radeon); @@ -504,17 +504,17 @@ static void emit_zstencil_format(GLcontext *ctx, struct radeon_state_atom * atom END_BATCH(); } -static int check_never(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_never(struct gl_context *ctx, struct radeon_state_atom *atom) { return 0; } -static int check_always(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_always(struct gl_context *ctx, struct radeon_state_atom *atom) { return atom->cmd_size; } -static int check_variable(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_variable(struct gl_context *ctx, struct radeon_state_atom *atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); int cnt; @@ -525,7 +525,7 @@ static int check_variable(GLcontext *ctx, struct radeon_state_atom *atom) return cnt ? cnt + 1 : 0; } -static int check_r500fp(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_r500fp(struct gl_context *ctx, struct radeon_state_atom *atom) { int cnt; r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -537,7 +537,7 @@ static int check_r500fp(GLcontext *ctx, struct radeon_state_atom *atom) return cnt ? (cnt * 6) + extra : 0; } -static int check_r500fp_const(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_r500fp_const(struct gl_context *ctx, struct radeon_state_atom *atom) { int cnt; r300ContextPtr r300 = R300_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.h b/src/mesa/drivers/dri/r300/r300_cmdbuf.h index 0e68da928e..7e6b8c5de6 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.h +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.h @@ -45,7 +45,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define SCISSORS_BUFSZ (3) void r300InitCmdBuf(r300ContextPtr r300); -void r300_emit_scissor(GLcontext *ctx); +void r300_emit_scissor(struct gl_context *ctx); void r300_emit_vpu(struct r300_context *ctx, uint32_t *data, diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 3d2f8928fa..9fbd36bfe6 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -134,7 +134,6 @@ static const struct dri_extension card_extensions[] = { {"GL_MESAX_texture_float", NULL}, {"GL_NV_blend_square", NULL}, {"GL_NV_vertex_program", GL_NV_vertex_program_functions}, - {"GL_SGIS_generate_mipmap", NULL}, {NULL, NULL} /* *INDENT-ON* */ }; @@ -220,7 +219,7 @@ static void r300_vtbl_pre_emit_atoms(radeonContextPtr radeon) end_3d(radeon); } -static void r300_fallback(GLcontext *ctx, GLuint bit, GLboolean mode) +static void r300_fallback(struct gl_context *ctx, GLuint bit, GLboolean mode) { r300ContextPtr r300 = R300_CONTEXT(ctx); if (mode) @@ -332,7 +331,7 @@ static void r300_init_vtbl(radeonContextPtr radeon) } } -static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen) +static void r300InitConstValues(struct gl_context *ctx, radeonScreenPtr screen) { r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -440,7 +439,7 @@ static void r300ParseOptions(r300ContextPtr r300, radeonScreenPtr screen) r300->options = options; } -static void r300InitGLExtensions(GLcontext *ctx) +static void r300InitGLExtensions(struct gl_context *ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -478,7 +477,7 @@ static void r300InitIoctlFuncs(struct dd_function_table *functions) /* Create the device specific rendering context. */ GLboolean r300CreateContext(gl_api api, - const __GLcontextModes * glVisual, + const struct gl_config * glVisual, __DRIcontext * driContextPriv, void *sharedContextPrivate) { @@ -486,7 +485,7 @@ GLboolean r300CreateContext(gl_api api, radeonScreenPtr screen = (radeonScreenPtr) (sPriv->private); struct dd_function_table functions; r300ContextPtr r300; - GLcontext *ctx; + struct gl_context *ctx; assert(glVisual); assert(driContextPriv); diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 99540e3354..349a3d412f 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -463,9 +463,9 @@ struct r300_swtcl_info { }; struct r300_vtable { - void (* SetupRSUnit)(GLcontext *ctx); - void (* SetupFragmentShaderTextures)(GLcontext *ctx, int *tmu_mappings); - void (* SetupPixelShader)(GLcontext *ctx); + void (* SetupRSUnit)(struct gl_context *ctx); + void (* SetupFragmentShaderTextures)(struct gl_context *ctx, int *tmu_mappings); + void (* SetupPixelShader)(struct gl_context *ctx); }; struct r300_vertex_buffer { @@ -544,7 +544,7 @@ struct r300_context { extern void r300DestroyContext(__DRIcontext * driContextPriv); extern GLboolean r300CreateContext(gl_api api, - const __GLcontextModes * glVisual, + const struct gl_config * glVisual, __DRIcontext * driContextPriv, void *sharedContextPrivate); @@ -552,7 +552,7 @@ extern void r300InitShaderFuncs(struct dd_function_table *functions); extern void r300InitShaderFunctions(r300ContextPtr r300); -extern void r300InitDraw(GLcontext *ctx); +extern void r300InitDraw(struct gl_context *ctx); #define r300PackFloat32 radeonPackFloat32 #define r300PackFloat24 radeonPackFloat24 diff --git a/src/mesa/drivers/dri/r300/r300_draw.c b/src/mesa/drivers/dri/r300/r300_draw.c index 5ae9f49840..81769e1ee5 100644 --- a/src/mesa/drivers/dri/r300/r300_draw.c +++ b/src/mesa/drivers/dri/r300/r300_draw.c @@ -75,7 +75,7 @@ static int getTypeSize(GLenum type) } } -static void r300FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer *mesa_ind_buf) +static void r300FixupIndexBuffer(struct gl_context *ctx, const struct _mesa_index_buffer *mesa_ind_buf) { r300ContextPtr r300 = R300_CONTEXT(ctx); GLvoid *src_ptr; @@ -143,7 +143,7 @@ static void r300FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer } -static void r300SetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer *mesa_ind_buf) +static void r300SetupIndexBuffer(struct gl_context *ctx, const struct _mesa_index_buffer *mesa_ind_buf) { r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -219,7 +219,7 @@ static void r300SetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer * Convert attribute data type to float * If the attribute uses named buffer object replace the bo with newly allocated bo */ -static void r300ConvertAttrib(GLcontext *ctx, int count, const struct gl_client_array *input, struct vertex_attribute *attr) +static void r300ConvertAttrib(struct gl_context *ctx, int count, const struct gl_client_array *input, struct vertex_attribute *attr) { r300ContextPtr r300 = R300_CONTEXT(ctx); const GLvoid *src_ptr; @@ -290,7 +290,7 @@ static void r300ConvertAttrib(GLcontext *ctx, int count, const struct gl_client_ } } -static void r300AlignDataToDword(GLcontext *ctx, const struct gl_client_array *input, int count, struct vertex_attribute *attr) +static void r300AlignDataToDword(struct gl_context *ctx, const struct gl_client_array *input, int count, struct vertex_attribute *attr) { r300ContextPtr r300 = R300_CONTEXT(ctx); const int dst_stride = (input->StrideB + 3) & ~3; @@ -328,7 +328,7 @@ static void r300AlignDataToDword(GLcontext *ctx, const struct gl_client_array *i attr->stride = dst_stride; } -static void r300TranslateAttrib(GLcontext *ctx, GLuint attr, int count, const struct gl_client_array *input) +static void r300TranslateAttrib(struct gl_context *ctx, GLuint attr, int count, const struct gl_client_array *input) { r300ContextPtr r300 = R300_CONTEXT(ctx); struct r300_vertex_buffer *vbuf = &r300->vbuf; @@ -467,7 +467,7 @@ static void r300TranslateAttrib(GLcontext *ctx, GLuint attr, int count, const st ++vbuf->num_attribs; } -static void r300SetVertexFormat(GLcontext *ctx, const struct gl_client_array *arrays[], int count) +static void r300SetVertexFormat(struct gl_context *ctx, const struct gl_client_array *arrays[], int count) { r300ContextPtr r300 = R300_CONTEXT(ctx); struct r300_vertex_buffer *vbuf = &r300->vbuf; @@ -497,7 +497,7 @@ static void r300SetVertexFormat(GLcontext *ctx, const struct gl_client_array *ar return; } -static void r300AllocDmaRegions(GLcontext *ctx, const struct gl_client_array *input[], int count) +static void r300AllocDmaRegions(struct gl_context *ctx, const struct gl_client_array *input[], int count) { r300ContextPtr r300 = R300_CONTEXT(ctx); struct r300_vertex_buffer *vbuf = &r300->vbuf; @@ -578,7 +578,7 @@ static void r300AllocDmaRegions(GLcontext *ctx, const struct gl_client_array *in } -static void r300FreeData(GLcontext *ctx) +static void r300FreeData(struct gl_context *ctx) { /* Need to zero tcl.aos[n].bo and tcl.elt_dma_bo * to prevent double unref in radeonReleaseArrays @@ -604,7 +604,7 @@ static void r300FreeData(GLcontext *ctx) } } -static GLuint r300PredictTryDrawPrimsSize(GLcontext *ctx, +static GLuint r300PredictTryDrawPrimsSize(struct gl_context *ctx, GLuint nr_prims, const struct _mesa_prim *prim) { struct r300_context *r300 = R300_CONTEXT(ctx); @@ -641,7 +641,7 @@ static GLuint r300PredictTryDrawPrimsSize(GLcontext *ctx, return dwords; } -static GLboolean r300TryDrawPrims(GLcontext *ctx, +static GLboolean r300TryDrawPrims(struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, @@ -707,7 +707,7 @@ static GLboolean r300TryDrawPrims(GLcontext *ctx, return GL_TRUE; } -static void r300DrawPrims(GLcontext *ctx, +static void r300DrawPrims(struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, @@ -741,7 +741,7 @@ static void r300DrawPrims(GLcontext *ctx, _tnl_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index); } -void r300InitDraw(GLcontext *ctx) +void r300InitDraw(struct gl_context *ctx) { struct vbo_context *vbo = vbo_context(ctx); diff --git a/src/mesa/drivers/dri/r300/r300_emit.c b/src/mesa/drivers/dri/r300/r300_emit.c index a24d431611..f392006ced 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.c +++ b/src/mesa/drivers/dri/r300/r300_emit.c @@ -48,14 +48,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_emit.h" -GLuint r300VAPInputCntl0(GLcontext * ctx, GLuint InputsRead) +GLuint r300VAPInputCntl0(struct gl_context * ctx, GLuint InputsRead) { /* No idea what this value means. I have seen other values written to * this register... */ return 0x5555; } -GLuint r300VAPInputCntl1(GLcontext * ctx, GLuint InputsRead) +GLuint r300VAPInputCntl1(struct gl_context * ctx, GLuint InputsRead) { GLuint i, vic_1 = 0; @@ -76,7 +76,7 @@ GLuint r300VAPInputCntl1(GLcontext * ctx, GLuint InputsRead) return vic_1; } -GLuint r300VAPOutputCntl0(GLcontext * ctx, GLuint vp_writes) +GLuint r300VAPOutputCntl0(struct gl_context * ctx, GLuint vp_writes) { GLuint ret = 0; @@ -100,7 +100,7 @@ GLuint r300VAPOutputCntl0(GLcontext * ctx, GLuint vp_writes) return ret; } -GLuint r300VAPOutputCntl1(GLcontext * ctx, GLuint vp_writes) +GLuint r300VAPOutputCntl1(struct gl_context * ctx, GLuint vp_writes) { GLuint i, ret = 0, first_free_texcoord = 0; diff --git a/src/mesa/drivers/dri/r300/r300_emit.h b/src/mesa/drivers/dri/r300/r300_emit.h index a456d8867c..8911ab7728 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.h +++ b/src/mesa/drivers/dri/r300/r300_emit.h @@ -220,9 +220,9 @@ extern int r300NumVerts(r300ContextPtr rmesa, int num_verts, int prim); extern void r300EmitCacheFlush(r300ContextPtr rmesa); -extern GLuint r300VAPInputCntl0(GLcontext * ctx, GLuint InputsRead); -extern GLuint r300VAPInputCntl1(GLcontext * ctx, GLuint InputsRead); -extern GLuint r300VAPOutputCntl0(GLcontext * ctx, GLuint vp_writes); -extern GLuint r300VAPOutputCntl1(GLcontext * ctx, GLuint vp_writes); +extern GLuint r300VAPInputCntl0(struct gl_context * ctx, GLuint InputsRead); +extern GLuint r300VAPInputCntl1(struct gl_context * ctx, GLuint InputsRead); +extern GLuint r300VAPOutputCntl0(struct gl_context * ctx, GLuint vp_writes); +extern GLuint r300VAPOutputCntl1(struct gl_context * ctx, GLuint vp_writes); #endif diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c index 4af91f114d..4e457b51eb 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c @@ -208,7 +208,7 @@ static void allocate_hw_inputs( } -static void translate_fragment_program(GLcontext *ctx, struct r300_fragment_program_cont *cont, struct r300_fragment_program *fp) +static void translate_fragment_program(struct gl_context *ctx, struct r300_fragment_program_cont *cont, struct r300_fragment_program *fp) { r300ContextPtr r300 = R300_CONTEXT(ctx); struct r300_fragment_program_compiler compiler; @@ -278,7 +278,7 @@ static void translate_fragment_program(GLcontext *ctx, struct r300_fragment_prog rc_destroy(&compiler.Base); } -struct r300_fragment_program *r300SelectAndTranslateFragmentShader(GLcontext *ctx) +struct r300_fragment_program *r300SelectAndTranslateFragmentShader(struct gl_context *ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); struct r300_fragment_program_cont *fp_list; diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.h b/src/mesa/drivers/dri/r300/r300_fragprog_common.h index 3d64c08cee..cfa5acf433 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_common.h +++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.h @@ -32,6 +32,6 @@ #include "r300_context.h" -struct r300_fragment_program *r300SelectAndTranslateFragmentShader(GLcontext *ctx); +struct r300_fragment_program *r300SelectAndTranslateFragmentShader(struct gl_context *ctx); #endif diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index cf89ab7ec3..821318e7a5 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -321,7 +321,7 @@ static void r300FireAOS(r300ContextPtr rmesa, int vertex_count, int type) END_BATCH(); } -void r300RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim) +void r300RunRenderPrimitive(struct gl_context * ctx, int start, int end, int prim) { r300ContextPtr rmesa = R300_CONTEXT(ctx); BATCH_LOCALS(&rmesa->radeon); @@ -444,7 +444,7 @@ static const char *getFallbackString(r300ContextPtr rmesa, uint32_t bit) } } -void r300SwitchFallback(GLcontext *ctx, uint32_t bit, GLboolean mode) +void r300SwitchFallback(struct gl_context *ctx, uint32_t bit, GLboolean mode) { TNLcontext *tnl = TNL_CONTEXT(ctx); r300ContextPtr rmesa = R300_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/r300/r300_render.h b/src/mesa/drivers/dri/r300/r300_render.h index 581e9fa0cc..5a78592c75 100644 --- a/src/mesa/drivers/dri/r300/r300_render.h +++ b/src/mesa/drivers/dri/r300/r300_render.h @@ -63,8 +63,8 @@ extern const struct tnl_pipeline_stage _r300_render_stage; -extern void r300SwitchFallback(GLcontext *ctx, uint32_t bit, GLboolean mode); +extern void r300SwitchFallback(struct gl_context *ctx, uint32_t bit, GLboolean mode); -extern void r300RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim); +extern void r300RunRenderPrimitive(struct gl_context * ctx, int start, int end, int prim); #endif diff --git a/src/mesa/drivers/dri/r300/r300_shader.c b/src/mesa/drivers/dri/r300/r300_shader.c index a9bddf0577..f2bbac5b85 100644 --- a/src/mesa/drivers/dri/r300/r300_shader.c +++ b/src/mesa/drivers/dri/r300/r300_shader.c @@ -32,7 +32,7 @@ #include "r300_context.h" #include "r300_fragprog_common.h" -static void freeFragProgCache(GLcontext *ctx, struct r300_fragment_program_cont *cache) +static void freeFragProgCache(struct gl_context *ctx, struct r300_fragment_program_cont *cache) { struct r300_fragment_program *tmp, *fp = cache->progs; @@ -44,7 +44,7 @@ static void freeFragProgCache(GLcontext *ctx, struct r300_fragment_program_cont } } -static void freeVertProgCache(GLcontext *ctx, struct r300_vertex_program_cont *cache) +static void freeVertProgCache(struct gl_context *ctx, struct r300_vertex_program_cont *cache) { struct r300_vertex_program *tmp, *vp = cache->progs; @@ -57,7 +57,7 @@ static void freeVertProgCache(GLcontext *ctx, struct r300_vertex_program_cont *c } } -static struct gl_program *r300NewProgram(GLcontext * ctx, GLenum target, +static struct gl_program *r300NewProgram(struct gl_context * ctx, GLenum target, GLuint id) { struct r300_vertex_program_cont *vp; @@ -81,7 +81,7 @@ static struct gl_program *r300NewProgram(GLcontext * ctx, GLenum target, return NULL; } -static void r300DeleteProgram(GLcontext * ctx, struct gl_program *prog) +static void r300DeleteProgram(struct gl_context * ctx, struct gl_program *prog) { struct r300_vertex_program_cont *vp = (struct r300_vertex_program_cont *)prog; struct r300_fragment_program_cont *fp = (struct r300_fragment_program_cont *)prog; @@ -99,7 +99,7 @@ static void r300DeleteProgram(GLcontext * ctx, struct gl_program *prog) } static GLboolean -r300ProgramStringNotify(GLcontext * ctx, GLenum target, struct gl_program *prog) +r300ProgramStringNotify(struct gl_context * ctx, GLenum target, struct gl_program *prog) { struct r300_vertex_program_cont *vp = (struct r300_vertex_program_cont *)prog; struct r300_fragment_program_cont *fp = (struct r300_fragment_program_cont *)prog; @@ -123,7 +123,7 @@ r300ProgramStringNotify(GLcontext * ctx, GLenum target, struct gl_program *prog) } static GLboolean -r300IsProgramNative(GLcontext * ctx, GLenum target, struct gl_program *prog) +r300IsProgramNative(struct gl_context * ctx, GLenum target, struct gl_program *prog) { if (target == GL_FRAGMENT_PROGRAM_ARB) { struct r300_fragment_program *fp = r300SelectAndTranslateFragmentShader(ctx); diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 0113eecaa3..ab8c1df5f7 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -62,7 +62,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_render.h" #include "r300_vertprog.h" -static void r300BlendColor(GLcontext * ctx, const GLfloat cf[4]) +static void r300BlendColor(struct gl_context * ctx, const GLfloat cf[4]) { r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -204,7 +204,7 @@ static void r300SetBlendCntl(r300ContextPtr r300, int func, int eqn, } } -static void r300SetBlendState(GLcontext * ctx) +static void r300SetBlendState(struct gl_context * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); int func = (R300_BLEND_GL_ONE << R300_SRC_BLEND_SHIFT) | @@ -302,13 +302,13 @@ static void r300SetBlendState(GLcontext * ctx) R300_ALPHA_BLEND_ENABLE), funcA, eqnA); } -static void r300BlendEquationSeparate(GLcontext * ctx, +static void r300BlendEquationSeparate(struct gl_context * ctx, GLenum modeRGB, GLenum modeA) { r300SetBlendState(ctx); } -static void r300BlendFuncSeparate(GLcontext * ctx, +static void r300BlendFuncSeparate(struct gl_context * ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA) { @@ -331,7 +331,7 @@ static GLuint translate_logicop(GLenum logicop) * Used internally to update the r300->hw hardware state to match the * current OpenGL state. */ -static void r300SetLogicOpState(GLcontext *ctx) +static void r300SetLogicOpState(struct gl_context *ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); R300_STATECHANGE(r300, rop); @@ -347,13 +347,13 @@ static void r300SetLogicOpState(GLcontext *ctx) * Called by Mesa when an application program changes the LogicOp state * via glLogicOp. */ -static void r300LogicOpcode(GLcontext *ctx, GLenum logicop) +static void r300LogicOpcode(struct gl_context *ctx, GLenum logicop) { if (RGBA_LOGICOP_ENABLED(ctx)) r300SetLogicOpState(ctx); } -static void r300ClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq ) +static void r300ClipPlane( struct gl_context *ctx, GLenum plane, const GLfloat *eq ) { r300ContextPtr rmesa = R300_CONTEXT(ctx); GLint p; @@ -373,7 +373,7 @@ static void r300ClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq ) rmesa->hw.vpucp[p].cmd[R300_VPUCP_W] = ip[3]; } -static void r300SetClipPlaneState(GLcontext * ctx, GLenum cap, GLboolean state) +static void r300SetClipPlaneState(struct gl_context * ctx, GLenum cap, GLboolean state) { r300ContextPtr r300 = R300_CONTEXT(ctx); GLuint p; @@ -395,7 +395,7 @@ static void r300SetClipPlaneState(GLcontext * ctx, GLenum cap, GLboolean state) /** * Update our tracked culling state based on Mesa's state. */ -static void r300UpdateCulling(GLcontext * ctx) +static void r300UpdateCulling(struct gl_context * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); uint32_t val = 0; @@ -435,7 +435,7 @@ static void r300UpdateCulling(GLcontext * ctx) r300->hw.cul.cmd[R300_CUL_CULL] = val; } -static void r300SetPolygonOffsetState(GLcontext * ctx, GLboolean state) +static void r300SetPolygonOffsetState(struct gl_context * ctx, GLboolean state) { r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -447,14 +447,14 @@ static void r300SetPolygonOffsetState(GLcontext * ctx, GLboolean state) } } -static GLboolean current_fragment_program_writes_depth(GLcontext* ctx) +static GLboolean current_fragment_program_writes_depth(struct gl_context* ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); return ctx->FragmentProgram._Current && r300->selected_fp->code.writes_depth; } -static void r300SetEarlyZState(GLcontext * ctx) +static void r300SetEarlyZState(struct gl_context * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); GLuint topZ = R300_ZTOP_ENABLE; @@ -499,7 +499,7 @@ static void r300SetEarlyZState(GLcontext * ctx) } } -static void r300SetAlphaState(GLcontext * ctx) +static void r300SetAlphaState(struct gl_context * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); GLubyte refByte; @@ -549,7 +549,7 @@ static void r300SetAlphaState(GLcontext * ctx) r300->hw.at.cmd[R300_AT_UNKNOWN] = 0; } -static void r300AlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref) +static void r300AlphaFunc(struct gl_context * ctx, GLenum func, GLfloat ref) { (void)func; (void)ref; @@ -579,7 +579,7 @@ static int translate_func(int func) return 0; } -static void r300SetDepthState(GLcontext * ctx) +static void r300SetDepthState(struct gl_context * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -598,7 +598,7 @@ static void r300SetDepthState(GLcontext * ctx) } } -static void r300CatchStencilFallback(GLcontext *ctx) +static void r300CatchStencilFallback(struct gl_context *ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); const unsigned back = ctx->Stencil._BackFace; @@ -616,7 +616,7 @@ static void r300CatchStencilFallback(GLcontext *ctx) } } -static void r300SetStencilState(GLcontext * ctx, GLboolean state) +static void r300SetStencilState(struct gl_context * ctx, GLboolean state) { r300ContextPtr r300 = R300_CONTEXT(ctx); GLboolean hw_stencil = GL_FALSE; @@ -641,7 +641,7 @@ static void r300SetStencilState(GLcontext * ctx, GLboolean state) } } -static void r300UpdatePolygonMode(GLcontext * ctx) +static void r300UpdatePolygonMode(struct gl_context * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); uint32_t hw_mode = R300_GA_POLY_MODE_DISABLE; @@ -704,7 +704,7 @@ static void r300UpdatePolygonMode(GLcontext * ctx) * * \note Mesa already filters redundant calls to this function. */ -static void r300CullFace(GLcontext * ctx, GLenum mode) +static void r300CullFace(struct gl_context * ctx, GLenum mode) { (void)mode; @@ -716,7 +716,7 @@ static void r300CullFace(GLcontext * ctx, GLenum mode) * * \note Mesa already filters redundant calls to this function. */ -static void r300FrontFace(GLcontext * ctx, GLenum mode) +static void r300FrontFace(struct gl_context * ctx, GLenum mode) { (void)mode; @@ -729,7 +729,7 @@ static void r300FrontFace(GLcontext * ctx, GLenum mode) * * \note Mesa already filters redundant calls to this function. */ -static void r300DepthFunc(GLcontext * ctx, GLenum func) +static void r300DepthFunc(struct gl_context * ctx, GLenum func) { (void)func; r300SetDepthState(ctx); @@ -740,7 +740,7 @@ static void r300DepthFunc(GLcontext * ctx, GLenum func) * * \note Mesa already filters redundant calls to this function. */ -static void r300DepthMask(GLcontext * ctx, GLboolean mask) +static void r300DepthMask(struct gl_context * ctx, GLboolean mask) { (void)mask; r300SetDepthState(ctx); @@ -749,7 +749,7 @@ static void r300DepthMask(GLcontext * ctx, GLboolean mask) /** * Handle glColorMask() */ -static void r300ColorMask(GLcontext * ctx, +static void r300ColorMask(struct gl_context * ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a) { r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -767,7 +767,7 @@ static void r300ColorMask(GLcontext * ctx, /* ============================================================= * Point state */ -static void r300PointSize(GLcontext * ctx, GLfloat size) +static void r300PointSize(struct gl_context * ctx, GLfloat size) { r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -784,7 +784,7 @@ static void r300PointSize(GLcontext * ctx, GLfloat size) ((int)(size * 6) << R300_POINTSIZE_Y_SHIFT); } -static void r300PointParameter(GLcontext * ctx, GLenum pname, const GLfloat * param) +static void r300PointParameter(struct gl_context * ctx, GLenum pname, const GLfloat * param) { r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -814,7 +814,7 @@ static void r300PointParameter(GLcontext * ctx, GLenum pname, const GLfloat * pa /* ============================================================= * Line state */ -static void r300LineWidth(GLcontext * ctx, GLfloat widthf) +static void r300LineWidth(struct gl_context * ctx, GLfloat widthf) { r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -826,7 +826,7 @@ static void r300LineWidth(GLcontext * ctx, GLfloat widthf) R300_LINE_CNT_HO | R300_LINE_CNT_VE | (int)(widthf * 6.0); } -static void r300PolygonMode(GLcontext * ctx, GLenum face, GLenum mode) +static void r300PolygonMode(struct gl_context * ctx, GLenum face, GLenum mode) { (void)face; (void)mode; @@ -864,7 +864,7 @@ static int translate_stencil_op(int op) return 0; } -static void r300ShadeModel(GLcontext * ctx, GLenum mode) +static void r300ShadeModel(struct gl_context * ctx, GLenum mode) { r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -885,7 +885,7 @@ static void r300ShadeModel(GLcontext * ctx, GLenum mode) rmesa->hw.shade2.cmd[3] = 0x00000000; } -static void r300StencilFuncSeparate(GLcontext * ctx, GLenum face, +static void r300StencilFuncSeparate(struct gl_context * ctx, GLenum face, GLenum func, GLint ref, GLuint mask) { r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -932,7 +932,7 @@ static void r300StencilFuncSeparate(GLcontext * ctx, GLenum face, } } -static void r300StencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask) +static void r300StencilMaskSeparate(struct gl_context * ctx, GLenum face, GLuint mask) { r300ContextPtr rmesa = R300_CONTEXT(ctx); const unsigned back = ctx->Stencil._BackFace; @@ -956,7 +956,7 @@ static void r300StencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask) } } -static void r300StencilOpSeparate(GLcontext * ctx, GLenum face, +static void r300StencilOpSeparate(struct gl_context * ctx, GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -992,7 +992,7 @@ static void r300StencilOpSeparate(GLcontext * ctx, GLenum face, * Window position and viewport transformation */ -static void r300UpdateWindow(GLcontext * ctx) +static void r300UpdateWindow(struct gl_context * ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon); @@ -1028,7 +1028,7 @@ static void r300UpdateWindow(GLcontext * ctx) rmesa->hw.vpt.cmd[R300_VPT_ZOFFSET] = r300PackFloat32(tz); } -static void r300Viewport(GLcontext * ctx, GLint x, GLint y, +static void r300Viewport(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height) { /* Don't pipeline viewport changes, conflict with window offset @@ -1040,12 +1040,12 @@ static void r300Viewport(GLcontext * ctx, GLint x, GLint y, radeon_viewport(ctx, x, y, width, height); } -static void r300DepthRange(GLcontext * ctx, GLclampd nearval, GLclampd farval) +static void r300DepthRange(struct gl_context * ctx, GLclampd nearval, GLclampd farval) { r300UpdateWindow(ctx); } -void r300UpdateViewportOffset(GLcontext * ctx) +void r300UpdateViewportOffset(struct gl_context * ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon); @@ -1074,7 +1074,7 @@ void r300UpdateViewportOffset(GLcontext * ctx) * Update R300's own internal state parameters. * For now just STATE_R300_WINDOW_DIMENSION */ -static void r300UpdateStateParameters(GLcontext * ctx, GLuint new_state) +static void r300UpdateStateParameters(struct gl_context * ctx, GLuint new_state) { r300ContextPtr rmesa = R300_CONTEXT(ctx); struct gl_program_parameter_list *paramList; @@ -1096,7 +1096,7 @@ static void r300UpdateStateParameters(GLcontext * ctx, GLuint new_state) /* ============================================================= * Polygon state */ -static void r300PolygonOffset(GLcontext * ctx, GLfloat factor, GLfloat units) +static void r300PolygonOffset(struct gl_context * ctx, GLfloat factor, GLfloat units) { r300ContextPtr rmesa = R300_CONTEXT(ctx); GLfloat constant = units; @@ -1193,7 +1193,7 @@ static unsigned long gen_fixed_filter(unsigned long f) return f; } -static void r300SetupFragmentShaderTextures(GLcontext *ctx, int *tmu_mappings) +static void r300SetupFragmentShaderTextures(struct gl_context *ctx, int *tmu_mappings) { r300ContextPtr r300 = R300_CONTEXT(ctx); int i; @@ -1235,7 +1235,7 @@ static void r300SetupFragmentShaderTextures(GLcontext *ctx, int *tmu_mappings) R300_US_TEX_INST_0, code->tex.length); } -static void r500SetupFragmentShaderTextures(GLcontext *ctx, int *tmu_mappings) +static void r500SetupFragmentShaderTextures(struct gl_context *ctx, int *tmu_mappings) { r300ContextPtr r300 = R300_CONTEXT(ctx); int i; @@ -1280,7 +1280,7 @@ static GLuint translate_lod_bias(GLfloat bias) } -static void r300SetupTextures(GLcontext * ctx) +static void r300SetupTextures(struct gl_context * ctx) { int i, mtu; struct radeon_tex_obj *t; @@ -1427,7 +1427,7 @@ union r300_outputs_written { ((hw_tcl_on) ? (ow).vp_outputs & (1 << (vp_result)) : \ RENDERINPUTS_TEST( (ow.index_bitset), (tnl_attrib) )) -static void r300SetupRSUnit(GLcontext * ctx) +static void r300SetupRSUnit(struct gl_context * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); union r300_outputs_written OutputsWritten; @@ -1521,7 +1521,7 @@ static void r300SetupRSUnit(GLcontext * ctx) WARN_ONCE("Don't know how to satisfy InputsRead=0x%08x\n", InputsRead); } -static void r500SetupRSUnit(GLcontext * ctx) +static void r500SetupRSUnit(struct gl_context * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); union r300_outputs_written OutputsWritten; @@ -1681,7 +1681,7 @@ void r300VapCntl(r300ContextPtr rmesa, GLuint input_count, * * \note Mesa already filters redundant calls to this function. */ -static void r300Enable(GLcontext * ctx, GLenum cap, GLboolean state) +static void r300Enable(struct gl_context * ctx, GLenum cap, GLboolean state) { r300ContextPtr rmesa = R300_CONTEXT(ctx); if (RADEON_DEBUG & RADEON_STATE) @@ -1756,7 +1756,7 @@ static void r300Enable(GLcontext * ctx, GLenum cap, GLboolean state) */ static void r300ResetHwState(r300ContextPtr r300) { - GLcontext *ctx = r300->radeon.glCtx; + struct gl_context *ctx = r300->radeon.glCtx; int has_tcl; has_tcl = r300->options.hw_tcl_enabled; @@ -1965,7 +1965,7 @@ static void r300ResetHwState(r300ContextPtr r300) void r300UpdateShaders(r300ContextPtr rmesa) { - GLcontext *ctx = rmesa->radeon.glCtx; + struct gl_context *ctx = rmesa->radeon.glCtx; /* should only happenen once, just after context is created */ /* TODO: shouldn't we fallback to sw here? */ @@ -1994,7 +1994,7 @@ void r300UpdateShaders(r300ContextPtr rmesa) rmesa->radeon.NewGLState = 0; } -static const GLfloat *get_fragmentprogram_constant(GLcontext *ctx, GLuint index, GLfloat * buffer) +static const GLfloat *get_fragmentprogram_constant(struct gl_context *ctx, GLuint index, GLfloat * buffer) { static const GLfloat dummy[4] = { 0, 0, 0, 0 }; r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -2052,7 +2052,7 @@ static const GLfloat *get_fragmentprogram_constant(GLcontext *ctx, GLuint index, } -static void r300SetupPixelShader(GLcontext *ctx) +static void r300SetupPixelShader(struct gl_context *ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); struct r300_fragment_program *fp = rmesa->selected_fp; @@ -2109,7 +2109,7 @@ static void r300SetupPixelShader(GLcontext *ctx) if(_nc>_p->r500fp.count)_p->r500fp.count=_nc;\ } while(0) -static void r500SetupPixelShader(GLcontext *ctx) +static void r500SetupPixelShader(struct gl_context *ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); struct r300_fragment_program *fp = rmesa->selected_fp; @@ -2158,7 +2158,7 @@ static void r500SetupPixelShader(GLcontext *ctx) bump_r500fp_const_count(rmesa->hw.r500fp_const.cmd, fp->code.constants.Count * 4); } -void r300SetupVAP(GLcontext *ctx, GLuint InputsRead, GLuint OutputsWritten) +void r300SetupVAP(struct gl_context *ctx, GLuint InputsRead, GLuint OutputsWritten) { r300ContextPtr rmesa = R300_CONTEXT( ctx ); struct vertex_attribute *attrs = rmesa->vbuf.attribs; @@ -2218,7 +2218,7 @@ void r300SetupVAP(GLcontext *ctx, GLuint InputsRead, GLuint OutputsWritten) void r300UpdateShaderStates(r300ContextPtr rmesa) { - GLcontext *ctx; + struct gl_context *ctx; ctx = rmesa->radeon.glCtx; /* should only happenen once, just after context is created */ @@ -2241,7 +2241,7 @@ void r300UpdateShaderStates(r300ContextPtr rmesa) #define EASY_US_OUT_FMT(comps, c0, c1, c2, c3) \ (R500_OUT_FMT_##comps | R500_C0_SEL_##c0 | R500_C1_SEL_##c1 | \ R500_C2_SEL_##c2 | R500_C3_SEL_##c3) -static void r300SetupUsOutputFormat(GLcontext *ctx) +static void r300SetupUsOutputFormat(struct gl_context *ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); uint32_t hw_format; @@ -2292,6 +2292,7 @@ static void r300SetupUsOutputFormat(GLcontext *ctx) break; default: assert(!"Unsupported format"); + hw_format = 0; break; } @@ -2303,7 +2304,7 @@ static void r300SetupUsOutputFormat(GLcontext *ctx) /** * Called by Mesa after an internal state update. */ -static void r300InvalidateState(GLcontext * ctx, GLuint new_state) +static void r300InvalidateState(struct gl_context * ctx, GLuint new_state) { r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -2346,7 +2347,7 @@ void r300InitState(r300ContextPtr r300) r300ResetHwState(r300); } -static void r300RenderMode(GLcontext * ctx, GLenum mode) +static void r300RenderMode(struct gl_context * ctx, GLenum mode) { r300SwitchFallback(ctx, R300_FALLBACK_RENDER_MODE, ctx->RenderMode != GL_RENDER); } diff --git a/src/mesa/drivers/dri/r300/r300_state.h b/src/mesa/drivers/dri/r300/r300_state.h index e70f84f4e4..e3b0da4cbd 100644 --- a/src/mesa/drivers/dri/r300/r300_state.h +++ b/src/mesa/drivers/dri/r300/r300_state.h @@ -50,13 +50,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. r300->radeon.hw.is_dirty = GL_TRUE; \ } while(0) -void r300UpdateViewportOffset (GLcontext * ctx); -void r300UpdateDrawBuffer (GLcontext * ctx); +void r300UpdateViewportOffset (struct gl_context * ctx); +void r300UpdateDrawBuffer (struct gl_context * ctx); void r300UpdateShaders (r300ContextPtr rmesa); void r300UpdateShaderStates (r300ContextPtr rmesa); void r300InitState (r300ContextPtr r300); void r300InitStateFuncs (radeonContextPtr radeon, struct dd_function_table *functions); void r300VapCntl(r300ContextPtr rmesa, GLuint input_count, GLuint output_count, GLuint temp_count); -void r300SetupVAP(GLcontext *ctx, GLuint InputsRead, GLuint OutputsWritten); +void r300SetupVAP(struct gl_context *ctx, GLuint InputsRead, GLuint OutputsWritten); #endif /* __R300_STATE_H__ */ diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c index 4dcc7cb022..4a6762ff83 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.c +++ b/src/mesa/drivers/dri/r300/r300_swtcl.c @@ -68,7 +68,7 @@ do { \ ++num_attrs; \ } while (0) -void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_OutputsWritten) +void r300ChooseSwtclVertexFormat(struct gl_context *ctx, GLuint *_InputsRead, GLuint *_OutputsWritten) { r300ContextPtr rmesa = R300_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -226,7 +226,7 @@ void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_ RENDERINPUTS_COPY(rmesa->render_inputs_bitset, tnl->render_inputs_bitset); } -static void r300PrepareVertices(GLcontext *ctx) +static void r300PrepareVertices(struct gl_context *ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); GLuint InputsRead, OutputsWritten; @@ -285,7 +285,7 @@ static GLuint reduced_prim[] = { GL_TRIANGLES, }; -static void r300RasterPrimitive( GLcontext *ctx, GLuint prim ); +static void r300RasterPrimitive( struct gl_context *ctx, GLuint prim ); /*********************************************************************** * Emit primitives as inline vertices * @@ -497,7 +497,7 @@ static void init_rast_tab( void ) /**********************************************************************/ /* Choose render functions */ /**********************************************************************/ -static void r300ChooseRenderState( GLcontext *ctx ) +static void r300ChooseRenderState( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -528,7 +528,7 @@ static void r300ChooseRenderState( GLcontext *ctx ) } } -void r300RenderStart(GLcontext *ctx) +void r300RenderStart(struct gl_context *ctx) { radeon_print(RADEON_SWRENDER, RADEON_VERBOSE, "%s\n", __func__); r300ContextPtr rmesa = R300_CONTEXT( ctx ); @@ -550,11 +550,11 @@ void r300RenderStart(GLcontext *ctx) } } -void r300RenderFinish(GLcontext *ctx) +void r300RenderFinish(struct gl_context *ctx) { } -static void r300RasterPrimitive( GLcontext *ctx, GLuint hwprim ) +static void r300RasterPrimitive( struct gl_context *ctx, GLuint hwprim ) { r300ContextPtr rmesa = R300_CONTEXT(ctx); radeon_print(RADEON_SWRENDER, RADEON_TRACE, "%s\n", __func__); @@ -565,7 +565,7 @@ static void r300RasterPrimitive( GLcontext *ctx, GLuint hwprim ) } } -void r300RenderPrimitive(GLcontext *ctx, GLenum prim) +void r300RenderPrimitive(struct gl_context *ctx, GLenum prim) { r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -578,13 +578,13 @@ void r300RenderPrimitive(GLcontext *ctx, GLenum prim) r300RasterPrimitive( ctx, reduced_prim[prim] ); } -void r300ResetLineStipple(GLcontext *ctx) +void r300ResetLineStipple(struct gl_context *ctx) { if (RADEON_DEBUG & RADEON_VERTS) fprintf(stderr, "%s\n", __func__); } -void r300InitSwtcl(GLcontext *ctx) +void r300InitSwtcl(struct gl_context *ctx) { TNLcontext *tnl = TNL_CONTEXT(ctx); r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -620,7 +620,7 @@ void r300InitSwtcl(GLcontext *ctx) _tnl_need_projected_coords( ctx, GL_FALSE ); } -void r300DestroySwtcl(GLcontext *ctx) +void r300DestroySwtcl(struct gl_context *ctx) { } @@ -656,7 +656,7 @@ static void r300EmitVbufPrim(r300ContextPtr rmesa, GLuint primitive, GLuint vert END_BATCH(); } -void r300_swtcl_flush(GLcontext *ctx, uint32_t current_offset) +void r300_swtcl_flush(struct gl_context *ctx, uint32_t current_offset) { radeon_print(RADEON_SWRENDER, RADEON_TRACE, "%s\n", __func__); r300ContextPtr rmesa = R300_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.h b/src/mesa/drivers/dri/r300/r300_swtcl.h index c271d26546..51cfffc2af 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.h +++ b/src/mesa/drivers/dri/r300/r300_swtcl.h @@ -50,16 +50,16 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define SWTCL_OVM_TEX(n) ((n) + 6) #define SWTCL_OVM_POINT_SIZE 15 -extern void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *InputsRead, GLuint *OutputsWritten); +extern void r300ChooseSwtclVertexFormat(struct gl_context *ctx, GLuint *InputsRead, GLuint *OutputsWritten); -extern void r300InitSwtcl( GLcontext *ctx ); -extern void r300DestroySwtcl( GLcontext *ctx ); +extern void r300InitSwtcl( struct gl_context *ctx ); +extern void r300DestroySwtcl( struct gl_context *ctx ); -extern void r300RenderStart(GLcontext *ctx); -extern void r300RenderFinish(GLcontext *ctx); -extern void r300RenderPrimitive(GLcontext *ctx, GLenum prim); -extern void r300ResetLineStipple(GLcontext *ctx); +extern void r300RenderStart(struct gl_context *ctx); +extern void r300RenderFinish(struct gl_context *ctx); +extern void r300RenderPrimitive(struct gl_context *ctx, GLenum prim); +extern void r300ResetLineStipple(struct gl_context *ctx); -extern void r300_swtcl_flush(GLcontext *ctx, uint32_t current_offset); +extern void r300_swtcl_flush(struct gl_context *ctx, uint32_t current_offset); #endif diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c index baef206bc2..a6bda0e499 100644 --- a/src/mesa/drivers/dri/r300/r300_tex.c +++ b/src/mesa/drivers/dri/r300/r300_tex.c @@ -185,7 +185,7 @@ static void r300SetTexBorderColor(radeonTexObjPtr t, const GLfloat color[4]) * next UpdateTextureState */ -static void r300TexParameter(GLcontext * ctx, GLenum target, +static void r300TexParameter(struct gl_context * ctx, GLenum target, struct gl_texture_object *texObj, GLenum pname, const GLfloat * params) { @@ -243,7 +243,7 @@ static void r300TexParameter(GLcontext * ctx, GLenum target, } } -static void r300DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj) +static void r300DeleteTexture(struct gl_context * ctx, struct gl_texture_object *texObj) { r300ContextPtr rmesa = R300_CONTEXT(ctx); radeonTexObj* t = radeon_tex_obj(texObj); @@ -284,7 +284,7 @@ static void r300DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj) * allocate the default texture objects. * Fixup MaxAnisotropy according to user preference. */ -static struct gl_texture_object *r300NewTextureObject(GLcontext * ctx, +static struct gl_texture_object *r300NewTextureObject(struct gl_context * ctx, GLuint name, GLenum target) { diff --git a/src/mesa/drivers/dri/r300/r300_tex.h b/src/mesa/drivers/dri/r300/r300_tex.h index aca44cd766..c44a39cb46 100644 --- a/src/mesa/drivers/dri/r300/r300_tex.h +++ b/src/mesa/drivers/dri/r300/r300_tex.h @@ -47,7 +47,7 @@ extern void r300SetTexOffset(__DRIcontext *pDRICtx, GLint texname, unsigned long long offset, GLint depth, GLuint pitch); -extern GLboolean r300ValidateBuffers(GLcontext * ctx); +extern GLboolean r300ValidateBuffers(struct gl_context * ctx); extern void r300InitTextureFuncs(radeonContextPtr radeon, struct dd_function_table *functions); diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index 9458869826..0116c5d2fa 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -301,7 +301,7 @@ static void setup_hardware_state(r300ContextPtr rmesa, radeonTexObj *t) * * Mostly this means populating the texture object's mipmap tree. */ -static GLboolean r300_validate_texture(GLcontext * ctx, struct gl_texture_object *texObj) +static GLboolean r300_validate_texture(struct gl_context * ctx, struct gl_texture_object *texObj) { r300ContextPtr rmesa = R300_CONTEXT(ctx); radeonTexObj *t = radeon_tex_obj(texObj); @@ -320,7 +320,7 @@ static GLboolean r300_validate_texture(GLcontext * ctx, struct gl_texture_object /** * Ensure all enabled and complete textures are uploaded along with any buffers being used. */ -GLboolean r300ValidateBuffers(GLcontext * ctx) +GLboolean r300ValidateBuffers(struct gl_context * ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); struct radeon_renderbuffer *rrb; diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index a160128091..1daa305e3c 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -49,7 +49,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * Write parameter array for the given vertex program into dst. * Return the total number of components written. */ -static int r300VertexProgUpdateParams(GLcontext * ctx, struct r300_vertex_program *vp, float *dst) +static int r300VertexProgUpdateParams(struct gl_context * ctx, struct r300_vertex_program *vp, float *dst) { int i; @@ -227,7 +227,7 @@ static void initialize_NV_registers(struct radeon_compiler * compiler) inst->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_0000; } -static struct r300_vertex_program *build_program(GLcontext *ctx, +static struct r300_vertex_program *build_program(struct gl_context *ctx, struct r300_vertex_program_key *wanted_key, const struct gl_vertex_program *mesa_vp) { @@ -307,7 +307,7 @@ static struct r300_vertex_program *build_program(GLcontext *ctx, return vp; } -struct r300_vertex_program * r300SelectAndTranslateVertexShader(GLcontext *ctx) +struct r300_vertex_program * r300SelectAndTranslateVertexShader(struct gl_context *ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); struct r300_vertex_program_key wanted_key = { 0 }; @@ -386,7 +386,7 @@ static void r300EmitVertexProgram(r300ContextPtr r300, int dest, struct r300_ver void r300SetupVertexProgram(r300ContextPtr rmesa) { - GLcontext *ctx = rmesa->radeon.glCtx; + struct gl_context *ctx = rmesa->radeon.glCtx; struct r300_vertex_program *prog = rmesa->selected_vp; int inst_count = 0; int param_count = 0; diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index ccec896be4..ce24dcb353 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -6,6 +6,6 @@ void r300SetupVertexProgram(r300ContextPtr rmesa); -struct r300_vertex_program * r300SelectAndTranslateVertexShader(GLcontext *ctx); +struct r300_vertex_program * r300SelectAndTranslateVertexShader(struct gl_context *ctx); #endif diff --git a/src/mesa/drivers/dri/r300/radeon_context.h b/src/mesa/drivers/dri/r300/radeon_context.h index da4812d323..52b7fb91e6 100644 --- a/src/mesa/drivers/dri/r300/radeon_context.h +++ b/src/mesa/drivers/dri/r300/radeon_context.h @@ -49,12 +49,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "drm.h" #include "dri_util.h" -#include "radeon_screen.h" - #define FALLBACK( radeon, bit, mode ) fprintf(stderr, "%s:%s\n", __LINE__, __FILE__); /* TCL fallbacks */ -extern void radeonTclFallback(GLcontext * ctx, GLuint bit, GLboolean mode); +extern void radeonTclFallback(struct gl_context * ctx, GLuint bit, GLboolean mode); #define TCL_FALLBACK( ctx, bit, mode ) ; diff --git a/src/mesa/drivers/dri/r600/evergreen_blit.c b/src/mesa/drivers/dri/r600/evergreen_blit.c index 1ed8a08b78..fc9fa9d22c 100644 --- a/src/mesa/drivers/dri/r600/evergreen_blit.c +++ b/src/mesa/drivers/dri/r600/evergreen_blit.c @@ -423,7 +423,7 @@ eg_set_render_target(context_t *context, struct radeon_bo *bo, gl_format mesa_fo } -static inline void eg_load_shaders(GLcontext * ctx) +static inline void eg_load_shaders(struct gl_context * ctx) { radeonContextPtr radeonctx = RADEON_CONTEXT(ctx); @@ -1688,7 +1688,7 @@ static GLboolean eg_validate_buffers(context_t *rmesa, return GL_TRUE; } -unsigned evergreen_blit(GLcontext *ctx, +unsigned evergreen_blit(struct gl_context *ctx, struct radeon_bo *src_bo, intptr_t src_offset, gl_format src_mesaformat, diff --git a/src/mesa/drivers/dri/r600/evergreen_blit.h b/src/mesa/drivers/dri/r600/evergreen_blit.h index 68d072ecb0..783f83f089 100644 --- a/src/mesa/drivers/dri/r600/evergreen_blit.h +++ b/src/mesa/drivers/dri/r600/evergreen_blit.h @@ -30,7 +30,7 @@ unsigned evergreen_check_blit(gl_format mesa_format); -unsigned evergreen_blit(GLcontext *ctx, +unsigned evergreen_blit(struct gl_context *ctx, struct radeon_bo *src_bo, intptr_t src_offset, gl_format src_mesaformat, diff --git a/src/mesa/drivers/dri/r600/evergreen_chip.c b/src/mesa/drivers/dri/r600/evergreen_chip.c index 1050c776bf..2c9e4e2b84 100644 --- a/src/mesa/drivers/dri/r600/evergreen_chip.c +++ b/src/mesa/drivers/dri/r600/evergreen_chip.c @@ -60,7 +60,7 @@ do { \ insert_at_tail(&context->radeon.hw.atomlist, &context->evergreen_atoms.ATOM); \ } while (0) -static int check_queryobj(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_queryobj(struct gl_context *ctx, struct radeon_state_atom *atom) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); struct radeon_query_object *query = radeon->query.current; @@ -74,7 +74,7 @@ static int check_queryobj(GLcontext *ctx, struct radeon_state_atom *atom) return count; } -static void evergreenSendQueryBegin(GLcontext *ctx, struct radeon_state_atom *atom) +static void evergreenSendQueryBegin(struct gl_context *ctx, struct radeon_state_atom *atom) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); struct radeon_query_object *query = radeon->query.current; @@ -114,12 +114,12 @@ static void evergreen_init_query_stateobj(radeonContextPtr radeon, int SZ) } -static int check_always(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_always(struct gl_context *ctx, struct radeon_state_atom *atom) { return atom->cmd_size; } -static void evergreenSendTexState(GLcontext *ctx, struct radeon_state_atom *atom) +static void evergreenSendTexState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -221,7 +221,7 @@ static void evergreenSendTexState(GLcontext *ctx, struct radeon_state_atom *atom } } -static int check_evergreen_tx(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_evergreen_tx(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = EVERGREEN_CONTEXT(ctx); unsigned int i, count = 0; @@ -238,7 +238,7 @@ static int check_evergreen_tx(GLcontext *ctx, struct radeon_state_atom *atom) return count * 37 + 6; } -static void evergreenSendSQConfig(GLcontext *ctx, struct radeon_state_atom *atom) +static void evergreenSendSQConfig(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -269,13 +269,12 @@ static void evergreenSendSQConfig(GLcontext *ctx, struct radeon_state_atom *atom } extern int evergreen_getTypeSize(GLenum type); -static void evergreenSetupVTXConstants(GLcontext * ctx, +static void evergreenSetupVTXConstants(struct gl_context * ctx, void * pAos, StreamDesc * pStreamDesc) { context_t *context = EVERGREEN_CONTEXT(ctx); struct radeon_aos * paos = (struct radeon_aos *)pAos; - unsigned int nVBsize; BATCH_LOCALS(&context->radeon); unsigned int uSQ_VTX_CONSTANT_WORD0_0; @@ -289,21 +288,11 @@ static void evergreenSetupVTXConstants(GLcontext * ctx, r700SyncSurf(context, paos->bo, RADEON_GEM_DOMAIN_GTT, 0, VC_ACTION_ENA_bit); - if(0 == pStreamDesc->stride) - { - nVBsize = paos->count * pStreamDesc->size * getTypeSize(pStreamDesc->type); - } - else - { - nVBsize = (paos->count - 1) * pStreamDesc->stride - + pStreamDesc->size * getTypeSize(pStreamDesc->type); - } - //uSQ_VTX_CONSTANT_WORD0_0 uSQ_VTX_CONSTANT_WORD0_0 = paos->offset; //uSQ_VTX_CONSTANT_WORD1_0 - uSQ_VTX_CONSTANT_WORD1_0 = nVBsize; + uSQ_VTX_CONSTANT_WORD1_0 = paos->bo->size - paos->offset - 1; //uSQ_VTX_CONSTANT_WORD2_0 SETfield(uSQ_VTX_CONSTANT_WORD2_0, @@ -368,7 +357,7 @@ static void evergreenSetupVTXConstants(GLcontext * ctx, COMMIT_BATCH(); } -static int check_evergreen_vtx(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_evergreen_vtx(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = EVERGREEN_CONTEXT(ctx); int count = context->radeon.tcl.aos_count * 12; @@ -380,7 +369,7 @@ static int check_evergreen_vtx(GLcontext *ctx, struct radeon_state_atom *atom) return count; } -static void evergreenSendVTX(GLcontext *ctx, struct radeon_state_atom *atom) +static void evergreenSendVTX(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = EVERGREEN_CONTEXT(ctx); struct evergreen_vertex_program *vp = (struct evergreen_vertex_program *)(context->selected_vp); @@ -391,17 +380,6 @@ static void evergreenSendVTX(GLcontext *ctx, struct radeon_state_atom *atom) if (context->radeon.tcl.aos_count == 0) return; - BEGIN_BATCH_NO_AUTOSTATE(6); - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, 1)); - R600_OUT_BATCH(mmSQ_VTX_BASE_VTX_LOC - ASIC_CTL_CONST_BASE_INDEX); - R600_OUT_BATCH(0); - - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, 1)); - R600_OUT_BATCH(mmSQ_VTX_START_INST_LOC - ASIC_CTL_CONST_BASE_INDEX); - R600_OUT_BATCH(0); - END_BATCH(); - COMMIT_BATCH(); - for(i=0; i<VERT_ATTRIB_MAX; i++) { if(vp->mesa_program->Base.InputsRead & (1 << i)) { @@ -410,9 +388,9 @@ static void evergreenSendVTX(GLcontext *ctx, struct radeon_state_atom *atom) &(context->stream_desc[j])); j++; } - } + } } -static void evergreenSendPA(GLcontext *ctx, struct radeon_state_atom *atom) +static void evergreenSendPA(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -533,7 +511,7 @@ static void evergreenSendPA(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void evergreenSendTP(GLcontext *ctx, struct radeon_state_atom *atom) +static void evergreenSendTP(struct gl_context *ctx, struct radeon_state_atom *atom) { /* context_t *context = EVERGREEN_CONTEXT(ctx); @@ -545,7 +523,7 @@ static void evergreenSendTP(GLcontext *ctx, struct radeon_state_atom *atom) */ } -static void evergreenSendPSresource(GLcontext *ctx) +static void evergreenSendPSresource(struct gl_context *ctx) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -600,7 +578,7 @@ static void evergreenSendPSresource(GLcontext *ctx) COMMIT_BATCH(); } -static void evergreenSendVSresource(GLcontext *ctx, struct radeon_state_atom *atom) +static void evergreenSendVSresource(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -656,7 +634,7 @@ static void evergreenSendVSresource(GLcontext *ctx, struct radeon_state_atom *at COMMIT_BATCH(); } -static void evergreenSendSQ(GLcontext *ctx, struct radeon_state_atom *atom) +static void evergreenSendSQ(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -771,7 +749,7 @@ static void evergreenSendSQ(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void evergreenSendSPI(GLcontext *ctx, struct radeon_state_atom *atom) +static void evergreenSendSPI(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -843,7 +821,7 @@ static void evergreenSendSPI(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void evergreenSendSX(GLcontext *ctx, struct radeon_state_atom *atom) +static void evergreenSendSX(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -865,7 +843,7 @@ static void evergreenSetDepthTarget(context_t *context) { EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); struct radeon_renderbuffer *rrb; - unsigned int nPitchInPixel, height; + unsigned int nPitchInPixel, height, offtostencil; rrb = radeon_get_depthbuffer(&context->radeon); if (!rrb) @@ -898,22 +876,28 @@ static void evergreenSetDepthTarget(context_t *context) if(4 == rrb->cpp) { - SETfield(evergreen->DB_Z_INFO.u32All, DEPTH_8_24, + SETfield(evergreen->DB_Z_INFO.u32All, EG_Z_24, EG_DB_Z_INFO__FORMAT_shift, EG_DB_Z_INFO__FORMAT_mask); } else { - SETfield(evergreen->DB_Z_INFO.u32All, DEPTH_16, + SETfield(evergreen->DB_Z_INFO.u32All, EG_Z_16, EG_DB_Z_INFO__FORMAT_shift, EG_DB_Z_INFO__FORMAT_mask); } SETfield(evergreen->DB_Z_INFO.u32All, ARRAY_1D_TILED_THIN1, EG_DB_Z_INFO__ARRAY_MODE_shift, EG_DB_Z_INFO__ARRAY_MODE_mask); + + + offtostencil = ((height * rrb->pitch) + 255) & ~255; + evergreen->DB_STENCIL_WRITE_BASE.u32All = offtostencil >> 8; + evergreen->DB_STENCIL_READ_BASE.u32All = offtostencil >> 8; + } -static void evergreenSendDB(GLcontext *ctx, struct radeon_state_atom *atom) +static void evergreenSendDB(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -971,17 +955,18 @@ static void evergreenSendDB(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); rrb = radeon_get_depthbuffer(&context->radeon); + if( (rrb != NULL) && (rrb->bo != NULL) ) { /* make the hw happy */ BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - EVERGREEN_OUT_BATCH_REGVAL(EG_DB_HTILE_DATA_BASE, evergreen->DB_HTILE_DATA_BASE.u32All); - R600_OUT_BATCH_RELOC(evergreen->DB_HTILE_DATA_BASE.u32All, + EVERGREEN_OUT_BATCH_REGVAL(EG_DB_HTILE_DATA_BASE, evergreen->DB_HTILE_DATA_BASE.u32All); + R600_OUT_BATCH_RELOC(evergreen->DB_HTILE_DATA_BASE.u32All, rrb->bo, evergreen->DB_HTILE_DATA_BASE.u32All, 0, RADEON_GEM_DOMAIN_VRAM, 0); - END_BATCH(); + END_BATCH(); //5 BEGIN_BATCH_NO_AUTOSTATE(3 + 2); @@ -1015,26 +1000,35 @@ static void evergreenSendDB(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } } -/* + if (ctx->DrawBuffer) { rrb = radeon_get_renderbuffer(ctx->DrawBuffer, BUFFER_STENCIL); if((rrb != NULL) && (rrb->bo != NULL)) - { + { //5 BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - EVERGREEN_OUT_BATCH_REGVAL(EG_DB_STENCIL_INFO, evergreen->DB_Z_INFO.u32All); + EVERGREEN_OUT_BATCH_REGVAL(EG_DB_STENCIL_INFO, evergreen->DB_STENCIL_INFO.u32All); R600_OUT_BATCH_RELOC(evergreen->DB_STENCIL_INFO.u32All, rrb->bo, evergreen->DB_STENCIL_INFO.u32All, 0, RADEON_GEM_DOMAIN_VRAM, 0); END_BATCH(); + + //4 + BEGIN_BATCH_NO_AUTOSTATE(4); + R600_OUT_BATCH_REGSEQ(DB_STENCILREFMASK, 2); + R600_OUT_BATCH(evergreen->DB_STENCILREFMASK.u32All); + R600_OUT_BATCH(evergreen->DB_STENCILREFMASK_BF.u32All); + END_BATCH(); + //------------------------ //10 if((evergreen->DB_DEPTH_CONTROL.u32All & STENCIL_ENABLE_bit) > 0) { - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); + + BEGIN_BATCH_NO_AUTOSTATE(3 + 2); EVERGREEN_OUT_BATCH_REGVAL(EG_DB_STENCIL_READ_BASE, evergreen->DB_STENCIL_READ_BASE.u32All); R600_OUT_BATCH_RELOC(evergreen->DB_STENCIL_READ_BASE.u32All, rrb->bo, @@ -1052,7 +1046,7 @@ static void evergreenSendDB(GLcontext *ctx, struct radeon_state_atom *atom) } } } -*/ + COMMIT_BATCH(); } @@ -1372,7 +1366,7 @@ static void evergreenSetRenderTarget(context_t *context, int id) evergreen->render_target[id].enabled = GL_TRUE; } -static void evergreenSendCB(GLcontext *ctx, struct radeon_state_atom *atom) +static void evergreenSendCB(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -1415,9 +1409,17 @@ static void evergreenSendCB(GLcontext *ctx, struct radeon_state_atom *atom) R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_VIEW.u32All); END_BATCH(); - BEGIN_BATCH_NO_AUTOSTATE(4); - EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_COLOR0_ATTRIB, 2); + BEGIN_BATCH_NO_AUTOSTATE(3 + 2); + EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_COLOR0_ATTRIB, 1); R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_ATTRIB.u32All); + R600_OUT_BATCH_RELOC(0, + rrb->bo, + 0, + 0, RADEON_GEM_DOMAIN_VRAM, 0); + END_BATCH(); + + BEGIN_BATCH_NO_AUTOSTATE(3); + EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_COLOR0_DIM, 1); R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_DIM.u32All); /* R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_CMASK.u32All); @@ -1449,7 +1451,7 @@ static void evergreenSendCB(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void evergreenSendVGT(GLcontext *ctx, struct radeon_state_atom *atom) +static void evergreenSendVGT(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -1514,7 +1516,7 @@ void evergreenInitAtoms(context_t *context) context->radeon.hw.atomlist.name = "atom-list"; EVERGREEN_ALLOC_STATE(init, always, 19, evergreenSendSQConfig); - EVERGREEN_ALLOC_STATE(vtx, evergreen_vtx, (6 + (VERT_ATTRIB_MAX * 12)), evergreenSendVTX); + EVERGREEN_ALLOC_STATE(vtx, evergreen_vtx, (VERT_ATTRIB_MAX * 12), evergreenSendVTX); EVERGREEN_ALLOC_STATE(pa, always, 124, evergreenSendPA); EVERGREEN_ALLOC_STATE(tp, always, 0, evergreenSendTP); EVERGREEN_ALLOC_STATE(sq, always, 86, evergreenSendSQ); /* 85 */ @@ -1522,8 +1524,8 @@ void evergreenInitAtoms(context_t *context) EVERGREEN_ALLOC_STATE(spi, always, 59, evergreenSendSPI); EVERGREEN_ALLOC_STATE(sx, always, 9, evergreenSendSX); EVERGREEN_ALLOC_STATE(tx, evergreen_tx, (R700_TEXTURE_NUMBERUNITS * (21+5) + 6), evergreenSendTexState); /* 21 for resource, 5 for sampler */ - EVERGREEN_ALLOC_STATE(db, always, 65, evergreenSendDB); - EVERGREEN_ALLOC_STATE(cb, always, 33, evergreenSendCB); + EVERGREEN_ALLOC_STATE(db, always, 69, evergreenSendDB); + EVERGREEN_ALLOC_STATE(cb, always, 37, evergreenSendCB); EVERGREEN_ALLOC_STATE(vgt, always, 29, evergreenSendVGT); evergreen_init_query_stateobj(&context->radeon, 6 * 2); diff --git a/src/mesa/drivers/dri/r600/evergreen_context.c b/src/mesa/drivers/dri/r600/evergreen_context.c index fff7c20031..911775f590 100644 --- a/src/mesa/drivers/dri/r600/evergreen_context.c +++ b/src/mesa/drivers/dri/r600/evergreen_context.c @@ -61,7 +61,7 @@ static void evergreen_vtbl_pre_emit_atoms(radeonContextPtr radeon) r700Start3D((context_t *)radeon); } -static void evergreen_fallback(GLcontext *ctx, GLuint bit, GLboolean mode) +static void evergreen_fallback(struct gl_context *ctx, GLuint bit, GLboolean mode) { context_t *context = EVERGREEN_CONTEXT(ctx); if (mode) diff --git a/src/mesa/drivers/dri/r600/evergreen_fragprog.c b/src/mesa/drivers/dri/r600/evergreen_fragprog.c index 0e7edf4fbe..cfb923efdd 100644 --- a/src/mesa/drivers/dri/r600/evergreen_fragprog.c +++ b/src/mesa/drivers/dri/r600/evergreen_fragprog.c @@ -44,7 +44,7 @@ #include "evergreen_vertprog.h" #include "evergreen_fragprog.h" -void evergreen_insert_wpos_code(GLcontext *ctx, struct gl_fragment_program *fprog) +void evergreen_insert_wpos_code(struct gl_context *ctx, struct gl_fragment_program *fprog) { static const gl_state_index winstate[STATE_LENGTH] = { STATE_INTERNAL, STATE_FB_SIZE, 0, 0, 0}; @@ -95,7 +95,7 @@ void evergreen_insert_wpos_code(GLcontext *ctx, struct gl_fragment_program *fpro //TODO : Validate FP input with VP output. void evergreen_Map_Fragment_Program(r700_AssemblerBase *pAsm, struct gl_fragment_program *mesa_fp, - GLcontext *ctx) + struct gl_context *ctx) { unsigned int unBit; unsigned int i; @@ -354,7 +354,7 @@ GLboolean evergreen_Find_Instruction_Dependencies_fp(struct evergreen_fragment_p GLboolean evergreenTranslateFragmentShader(struct evergreen_fragment_program *fp, struct gl_fragment_program *mesa_fp, - GLcontext *ctx) + struct gl_context *ctx) { GLuint number_of_colors_exported; GLboolean z_enabled = GL_FALSE; @@ -457,7 +457,7 @@ GLboolean evergreenTranslateFragmentShader(struct evergreen_fragment_program *fp return GL_TRUE; } -void evergreenSelectFragmentShader(GLcontext *ctx) +void evergreenSelectFragmentShader(struct gl_context *ctx) { context_t *context = EVERGREEN_CONTEXT(ctx); struct evergreen_fragment_program *fp = (struct evergreen_fragment_program *) @@ -471,7 +471,7 @@ void evergreenSelectFragmentShader(GLcontext *ctx) evergreenTranslateFragmentShader(fp, &(fp->mesa_program), ctx); } -void * evergreenGetActiveFpShaderBo(GLcontext * ctx) +void * evergreenGetActiveFpShaderBo(struct gl_context * ctx) { struct evergreen_fragment_program *fp = (struct evergreen_fragment_program *) (ctx->FragmentProgram._Current); @@ -479,7 +479,7 @@ void * evergreenGetActiveFpShaderBo(GLcontext * ctx) return fp->shaderbo; } -void * evergreenGetActiveFpShaderConstBo(GLcontext * ctx) +void * evergreenGetActiveFpShaderConstBo(struct gl_context * ctx) { struct evergreen_fragment_program *fp = (struct evergreen_fragment_program *) (ctx->FragmentProgram._Current); @@ -487,7 +487,7 @@ void * evergreenGetActiveFpShaderConstBo(GLcontext * ctx) return fp->constbo0; } -GLboolean evergreenSetupFragmentProgram(GLcontext * ctx) +GLboolean evergreenSetupFragmentProgram(struct gl_context * ctx) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -737,7 +737,7 @@ GLboolean evergreenSetupFragmentProgram(GLcontext * ctx) return GL_TRUE; } -GLboolean evergreenSetupFPconstants(GLcontext * ctx) +GLboolean evergreenSetupFPconstants(struct gl_context * ctx) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); diff --git a/src/mesa/drivers/dri/r600/evergreen_fragprog.h b/src/mesa/drivers/dri/r600/evergreen_fragprog.h index 0e200bf383..97f06a75fc 100644 --- a/src/mesa/drivers/dri/r600/evergreen_fragprog.h +++ b/src/mesa/drivers/dri/r600/evergreen_fragprog.h @@ -51,27 +51,27 @@ struct evergreen_fragment_program }; /* Internal */ -void evergreen_insert_wpos_code(GLcontext *ctx, struct gl_fragment_program *fprog); +void evergreen_insert_wpos_code(struct gl_context *ctx, struct gl_fragment_program *fprog); void evergreen_Map_Fragment_Program(r700_AssemblerBase *pAsm, struct gl_fragment_program *mesa_fp, - GLcontext *ctx); + struct gl_context *ctx); GLboolean evergreen_Find_Instruction_Dependencies_fp(struct evergreen_fragment_program *fp, struct gl_fragment_program *mesa_fp); GLboolean evergreenTranslateFragmentShader(struct evergreen_fragment_program *fp, struct gl_fragment_program *mesa_vp, - GLcontext *ctx); + struct gl_context *ctx); /* Interface */ -extern void evergreenSelectFragmentShader(GLcontext *ctx); +extern void evergreenSelectFragmentShader(struct gl_context *ctx); -extern GLboolean evergreenSetupFragmentProgram(GLcontext * ctx); +extern GLboolean evergreenSetupFragmentProgram(struct gl_context * ctx); -extern GLboolean evergreenSetupFPconstants(GLcontext * ctx); +extern GLboolean evergreenSetupFPconstants(struct gl_context * ctx); -extern void * evergreenGetActiveFpShaderBo(GLcontext * ctx); +extern void * evergreenGetActiveFpShaderBo(struct gl_context * ctx); -extern void * evergreenGetActiveFpShaderConstBo(GLcontext * ctx); +extern void * evergreenGetActiveFpShaderConstBo(struct gl_context * ctx); #endif /*_EVERGREEN_FRAGPROG_H_*/ diff --git a/src/mesa/drivers/dri/r600/evergreen_ioctl.c b/src/mesa/drivers/dri/r600/evergreen_ioctl.c index 5c1270790d..19f8e6b3ec 100644 --- a/src/mesa/drivers/dri/r600/evergreen_ioctl.c +++ b/src/mesa/drivers/dri/r600/evergreen_ioctl.c @@ -40,7 +40,7 @@ #include "r700_clear.h" -void evergreenClear(GLcontext * ctx, GLbitfield mask) +void evergreenClear(struct gl_context * ctx, GLbitfield mask) { r700Clear(ctx, mask); } diff --git a/src/mesa/drivers/dri/r600/evergreen_ioctl.h b/src/mesa/drivers/dri/r600/evergreen_ioctl.h index 3c663a7083..a41b5b6033 100644 --- a/src/mesa/drivers/dri/r600/evergreen_ioctl.h +++ b/src/mesa/drivers/dri/r600/evergreen_ioctl.h @@ -30,7 +30,7 @@ #include "r600_context.h" #include "radeon_drm.h" -extern void evergreenClear(GLcontext * ctx, GLbitfield mask); +extern void evergreenClear(struct gl_context * ctx, GLbitfield mask); extern void evergreenInitIoctlFuncs(struct dd_function_table *functions); #endif /* _EVERGREEN_IOCTL_H_ */ diff --git a/src/mesa/drivers/dri/r600/evergreen_oglprog.c b/src/mesa/drivers/dri/r600/evergreen_oglprog.c index 9fe523234c..a2a361f32e 100644 --- a/src/mesa/drivers/dri/r600/evergreen_oglprog.c +++ b/src/mesa/drivers/dri/r600/evergreen_oglprog.c @@ -40,7 +40,7 @@ #include "evergreen_vertprog.h" -static void evergreen_freeVertProgCache(GLcontext *ctx, struct r700_vertex_program_cont *cache) +static void evergreen_freeVertProgCache(struct gl_context *ctx, struct r700_vertex_program_cont *cache) { struct evergreen_vertex_program *tmp, *vp = cache->progs; @@ -64,7 +64,7 @@ static void evergreen_freeVertProgCache(GLcontext *ctx, struct r700_vertex_progr } } -static struct gl_program *evergreenNewProgram(GLcontext * ctx, +static struct gl_program *evergreenNewProgram(struct gl_context * ctx, GLenum target, GLuint id) { @@ -109,7 +109,7 @@ static struct gl_program *evergreenNewProgram(GLcontext * ctx, return pProgram; } -static void evergreenDeleteProgram(GLcontext * ctx, struct gl_program *prog) +static void evergreenDeleteProgram(struct gl_context * ctx, struct gl_program *prog) { struct evergreen_vertex_program_cont *vpc = (struct evergreen_vertex_program_cont *)prog; struct evergreen_fragment_program * fp; @@ -147,7 +147,7 @@ static void evergreenDeleteProgram(GLcontext * ctx, struct gl_program *prog) } static GLboolean -evergreenProgramStringNotify(GLcontext * ctx, GLenum target, struct gl_program *prog) +evergreenProgramStringNotify(struct gl_context * ctx, GLenum target, struct gl_program *prog) { struct evergreen_vertex_program_cont *vpc = (struct evergreen_vertex_program_cont *)prog; struct evergreen_fragment_program * fp = (struct evergreen_fragment_program*)prog; @@ -178,7 +178,7 @@ evergreenProgramStringNotify(GLcontext * ctx, GLenum target, struct gl_program * return GL_TRUE; } -static GLboolean evergreenIsProgramNative(GLcontext * ctx, GLenum target, struct gl_program *prog) +static GLboolean evergreenIsProgramNative(struct gl_context * ctx, GLenum target, struct gl_program *prog) { return GL_TRUE; diff --git a/src/mesa/drivers/dri/r600/evergreen_render.c b/src/mesa/drivers/dri/r600/evergreen_render.c index 85b2f9d6ab..0c0eeca1fc 100644 --- a/src/mesa/drivers/dri/r600/evergreen_render.c +++ b/src/mesa/drivers/dri/r600/evergreen_render.c @@ -148,7 +148,8 @@ static int evergreenNumVerts(int num_verts, int prim) //same return num_verts - verts_off; } -static void evergreenRunRenderPrimitive(GLcontext * ctx, int start, int end, int prim) //same +static void evergreenRunRenderPrimitive(struct gl_context * ctx, int start, int end, int prim, + GLint basevertex) //same { context_t *context = EVERGREEN_CONTEXT(ctx); BATCH_LOCALS(&context->radeon); @@ -186,6 +187,7 @@ static void evergreenRunRenderPrimitive(GLcontext * ctx, int start, int end, int total_emit = 3 /* VGT_PRIMITIVE_TYPE */ + 2 /* VGT_INDEX_TYPE */ + 2 /* NUM_INSTANCES */ + + 4 /* VTX_BASE_VTX_LOC + VTX_START_INST_LOC */ + 5 + 2; /* DRAW_INDEX */ BEGIN_BATCH_NO_AUTOSTATE(total_emit); @@ -198,6 +200,11 @@ static void evergreenRunRenderPrimitive(GLcontext * ctx, int start, int end, int // num instances R600_OUT_BATCH(CP_PACKET3(R600_IT_NUM_INSTANCES, 0)); R600_OUT_BATCH(1); + /* offset */ + R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, 2)); + R600_OUT_BATCH(mmSQ_VTX_BASE_VTX_LOC - ASIC_CTL_CONST_BASE_INDEX); + R600_OUT_BATCH(basevertex); //VTX_BASE_VTX_LOC + R600_OUT_BATCH(0); //VTX_START_INST_LOC // draw packet R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX, 3)); R600_OUT_BATCH(context->ind_buf.bo_offset); @@ -212,7 +219,7 @@ static void evergreenRunRenderPrimitive(GLcontext * ctx, int start, int end, int COMMIT_BATCH(); } -static void evergreenRunRenderPrimitiveImmediate(GLcontext * ctx, int start, int end, int prim) //same +static void evergreenRunRenderPrimitiveImmediate(struct gl_context * ctx, int start, int end, int prim) //same { context_t *context = EVERGREEN_CONTEXT(ctx); BATCH_LOCALS(&context->radeon); @@ -268,6 +275,7 @@ static void evergreenRunRenderPrimitiveImmediate(GLcontext * ctx, int start, int total_emit += 3 /* VGT_PRIMITIVE_TYPE */ + 2 /* VGT_INDEX_TYPE */ + 2 /* NUM_INSTANCES */ + + 4 /* VTX_BASE_VTX_LOC + VTX_START_INST_LOC */ + 3; /* DRAW */ BEGIN_BATCH_NO_AUTOSTATE(total_emit); @@ -280,6 +288,11 @@ static void evergreenRunRenderPrimitiveImmediate(GLcontext * ctx, int start, int // num instances R600_OUT_BATCH(CP_PACKET3(R600_IT_NUM_INSTANCES, 0)); R600_OUT_BATCH(1); + /* offset */ + R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, 2)); + R600_OUT_BATCH(mmSQ_VTX_BASE_VTX_LOC - ASIC_CTL_CONST_BASE_INDEX); + R600_OUT_BATCH(0); //VTX_BASE_VTX_LOC + R600_OUT_BATCH(0); //VTX_START_INST_LOC // draw packet if(start == 0) { @@ -350,7 +363,7 @@ static void evergreenRunRenderPrimitiveImmediate(GLcontext * ctx, int start, int * Convert attribute data type to float * If the attribute uses named buffer object replace the bo with newly allocated bo */ -static void evergreenConvertAttrib(GLcontext *ctx, int count, +static void evergreenConvertAttrib(struct gl_context *ctx, int count, const struct gl_client_array *input, struct StreamDesc *attr) { @@ -429,7 +442,7 @@ static void evergreenConvertAttrib(GLcontext *ctx, int count, } } -static void evergreenFixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer *mesa_ind_buf) +static void evergreenFixupIndexBuffer(struct gl_context *ctx, const struct _mesa_index_buffer *mesa_ind_buf) { context_t *context = EVERGREEN_CONTEXT(ctx); GLvoid *src_ptr; @@ -504,7 +517,7 @@ static void evergreenFixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_b } } -static GLboolean evergreen_check_fallbacks(GLcontext *ctx) //same +static GLboolean evergreen_check_fallbacks(struct gl_context *ctx) //same { if (ctx->RenderMode != GL_RENDER) return GL_TRUE; @@ -515,7 +528,7 @@ static GLboolean evergreen_check_fallbacks(GLcontext *ctx) //same /* start 3d, idle, cb/db flush */ #define PRE_EMIT_STATE_BUFSZ 5 + 5 + 14 -static GLuint evergreenPredictRenderSize(GLcontext* ctx, +static GLuint evergreenPredictRenderSize(struct gl_context* ctx, const struct _mesa_prim *prim, const struct _mesa_index_buffer *ib, GLuint nr_prims) @@ -527,16 +540,16 @@ static GLuint evergreenPredictRenderSize(GLcontext* ctx, dwords = PRE_EMIT_STATE_BUFSZ; if (ib) - dwords += nr_prims * 14; + dwords += nr_prims * 18; else { for (i = 0; i < nr_prims; ++i) { if (prim[i].start == 0) - dwords += 10; + dwords += 14; else if (prim[i].count > 0xffff) - dwords += prim[i].count + 10; + dwords += prim[i].count + 14; else - dwords += ((prim[i].count + 1) / 2) + 10; + dwords += ((prim[i].count + 1) / 2) + 14; } } @@ -554,7 +567,7 @@ static GLuint evergreenPredictRenderSize(GLcontext* ctx, } -static void evergreenSetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer *mesa_ind_buf) +static void evergreenSetupIndexBuffer(struct gl_context *ctx, const struct _mesa_index_buffer *mesa_ind_buf) { context_t *context = EVERGREEN_CONTEXT(ctx); @@ -607,7 +620,7 @@ static void evergreenSetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_b } } -static void evergreenAlignDataToDword(GLcontext *ctx, +static void evergreenAlignDataToDword(struct gl_context *ctx, const struct gl_client_array *input, int count, struct StreamDesc *attr) @@ -649,7 +662,7 @@ static void evergreenAlignDataToDword(GLcontext *ctx, attr->stride = dst_stride; } -static void evergreenSetupStreams(GLcontext *ctx, const struct gl_client_array *input[], int count) +static void evergreenSetupStreams(struct gl_context *ctx, const struct gl_client_array *input[], int count) { context_t *context = EVERGREEN_CONTEXT(ctx); GLuint stride; @@ -665,11 +678,11 @@ static void evergreenSetupStreams(GLcontext *ctx, const struct gl_client_array * stride = (input[i]->StrideB == 0) ? getTypeSize(input[i]->Type) * input[i]->Size : input[i]->StrideB; - if (input[i]->Type == GL_DOUBLE || input[i]->Type == GL_UNSIGNED_INT || input[i]->Type == GL_INT || + if (input[i]->Type == GL_DOUBLE || input[i]->Type == GL_UNSIGNED_INT || input[i]->Type == GL_INT #if MESA_BIG_ENDIAN - getTypeSize(input[i]->Type) != 4 || + || getTypeSize(input[i]->Type) != 4 #endif - stride < 4) + ) { evergreenConvertAttrib(ctx, count, input[i], &context->stream_desc[index]); } @@ -677,19 +690,10 @@ static void evergreenSetupStreams(GLcontext *ctx, const struct gl_client_array * { if (input[i]->BufferObj->Name) { - if (stride % 4 != 0) - { - assert(((intptr_t) input[i]->Ptr) % input[i]->StrideB == 0); - evergreenAlignDataToDword(ctx, input[i], count, &context->stream_desc[index]); - context->stream_desc[index].is_named_bo = GL_FALSE; - } - else - { - context->stream_desc[index].stride = input[i]->StrideB; - context->stream_desc[index].bo_offset = (intptr_t) input[i]->Ptr; - context->stream_desc[index].bo = get_radeon_buffer_object(input[i]->BufferObj)->bo; - context->stream_desc[index].is_named_bo = GL_TRUE; - } + context->stream_desc[index].stride = input[i]->StrideB; + context->stream_desc[index].bo_offset = (intptr_t) input[i]->Ptr; + context->stream_desc[index].bo = get_radeon_buffer_object(input[i]->BufferObj)->bo; + context->stream_desc[index].is_named_bo = GL_TRUE; } else { @@ -759,7 +763,7 @@ static void evergreenSetupStreams(GLcontext *ctx, const struct gl_client_array * RADEON_GEM_DOMAIN_GTT, 0); } -static void evergreenFreeData(GLcontext *ctx) +static void evergreenFreeData(struct gl_context *ctx) { /* Need to zero tcl.aos[n].bo and tcl.elt_dma_bo * to prevent double unref in radeonReleaseArrays @@ -795,7 +799,7 @@ static void evergreenFreeData(GLcontext *ctx) } } -static GLboolean evergreenTryDrawPrims(GLcontext *ctx, +static GLboolean evergreenTryDrawPrims(struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, @@ -857,7 +861,8 @@ static GLboolean evergreenTryDrawPrims(GLcontext *ctx, evergreenRunRenderPrimitive(ctx, prim[i].start, prim[i].start + prim[i].count, - prim[i].mode); + prim[i].mode, + prim[i].basevertex); else evergreenRunRenderPrimitiveImmediate(ctx, prim[i].start, @@ -893,7 +898,7 @@ static GLboolean evergreenTryDrawPrims(GLcontext *ctx, return GL_TRUE; } -static void evergreenDrawPrims(GLcontext *ctx, +static void evergreenDrawPrims(struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, @@ -907,15 +912,16 @@ static void evergreenDrawPrims(GLcontext *ctx, /* This check should get folded into just the places that * min/max index are really needed. */ - if (!index_bounds_valid) { - vbo_get_minmax_index(ctx, prim, ib, &min_index, &max_index); - } - - if (min_index) { - vbo_rebase_prims( ctx, arrays, prim, nr_prims, ib, min_index, max_index, evergreenDrawPrims ); - return; + if (!vbo_all_varyings_in_vbos(arrays)) { + if (!index_bounds_valid) + vbo_get_minmax_index(ctx, prim, ib, &min_index, &max_index); + /* do we want to rebase, minimizes the + * amount of data to upload? */ + if (min_index) { + vbo_rebase_prims( ctx, arrays, prim, nr_prims, ib, min_index, max_index, evergreenDrawPrims ); + return; + } } - /* Make an attempt at drawing */ retval = evergreenTryDrawPrims(ctx, arrays, prim, nr_prims, ib, min_index, max_index); @@ -926,7 +932,7 @@ static void evergreenDrawPrims(GLcontext *ctx, } } -void evergreenInitDraw(GLcontext *ctx) +void evergreenInitDraw(struct gl_context *ctx) { struct vbo_context *vbo = vbo_context(ctx); diff --git a/src/mesa/drivers/dri/r600/evergreen_state.c b/src/mesa/drivers/dri/r600/evergreen_state.c index 931478caa5..a77be183a1 100644 --- a/src/mesa/drivers/dri/r600/evergreen_state.c +++ b/src/mesa/drivers/dri/r600/evergreen_state.c @@ -53,9 +53,9 @@ #include "evergreen_fragprog.h" #include "evergreen_tex.h" -void evergreenUpdateStateParameters(GLcontext * ctx, GLuint new_state); //same +void evergreenUpdateStateParameters(struct gl_context * ctx, GLuint new_state); //same -void evergreenUpdateShaders(GLcontext * ctx) +void evergreenUpdateShaders(struct gl_context * ctx) { context_t *context = EVERGREEN_CONTEXT(ctx); @@ -73,7 +73,7 @@ void evergreenUpdateShaders(GLcontext * ctx) context->radeon.NewGLState = 0; } -void evergreeUpdateShaders(GLcontext * ctx) +void evergreeUpdateShaders(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); @@ -94,7 +94,7 @@ void evergreeUpdateShaders(GLcontext * ctx) /* * To correctly position primitives: */ -void evergreenUpdateViewportOffset(GLcontext * ctx) //------------------ +void evergreenUpdateViewportOffset(struct gl_context * ctx) //------------------ { context_t *context = R700_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -120,7 +120,7 @@ void evergreenUpdateViewportOffset(GLcontext * ctx) //------------------ radeonUpdateScissor(ctx); } -void evergreenUpdateStateParameters(GLcontext * ctx, GLuint new_state) //same +void evergreenUpdateStateParameters(struct gl_context * ctx, GLuint new_state) //same { struct evergreen_fragment_program *fp = (struct evergreen_fragment_program *)ctx->FragmentProgram._Current; @@ -144,7 +144,7 @@ void evergreenUpdateStateParameters(GLcontext * ctx, GLuint new_state) //same /** * Called by Mesa after an internal state update. */ -static void evergreenInvalidateState(GLcontext * ctx, GLuint new_state) //same +static void evergreenInvalidateState(struct gl_context * ctx, GLuint new_state) //same { context_t *context = EVERGREEN_CONTEXT(ctx); @@ -212,7 +212,7 @@ static void evergreenInvalidateState(GLcontext * ctx, GLuint new_state) //same context->radeon.NewGLState |= new_state; } -static void evergreenSetAlphaState(GLcontext * ctx) //same +static void evergreenSetAlphaState(struct gl_context * ctx) //same { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -259,14 +259,14 @@ static void evergreenSetAlphaState(GLcontext * ctx) //same } } -static void evergreenAlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref) //same +static void evergreenAlphaFunc(struct gl_context * ctx, GLenum func, GLfloat ref) //same { (void)func; (void)ref; evergreenSetAlphaState(ctx); } -static void evergreenBlendColor(GLcontext * ctx, const GLfloat cf[4]) //same +static void evergreenBlendColor(struct gl_context * ctx, const GLfloat cf[4]) //same { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -334,7 +334,7 @@ static int evergreenblend_factor(GLenum factor, GLboolean is_src) //same } } -static void evergreenSetBlendState(GLcontext * ctx) //diff : CB_COLOR_CONTROL, CB_BLEND0_CONTROL bits +static void evergreenSetBlendState(struct gl_context * ctx) //diff : CB_COLOR_CONTROL, CB_BLEND0_CONTROL bits { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -459,13 +459,13 @@ static void evergreenSetBlendState(GLcontext * ctx) //diff : CB_COLOR_CONTROL, C evergreen->CB_BLEND0_CONTROL.u32All = blend_reg; } -static void evergreenBlendEquationSeparate(GLcontext * ctx, +static void evergreenBlendEquationSeparate(struct gl_context * ctx, GLenum modeRGB, GLenum modeA) //same { evergreenSetBlendState(ctx); } -static void evergreenBlendFuncSeparate(GLcontext * ctx, +static void evergreenBlendFuncSeparate(struct gl_context * ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA) //same { @@ -513,7 +513,7 @@ static GLuint evergreen_translate_logicop(GLenum logicop) //same } } -static void evergreenSetLogicOpState(GLcontext *ctx) //diff : CB_COLOR_CONTROL.ROP3 is actually same bits. +static void evergreenSetLogicOpState(struct gl_context *ctx) //diff : CB_COLOR_CONTROL.ROP3 is actually same bits. { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -531,7 +531,7 @@ static void evergreenSetLogicOpState(GLcontext *ctx) //diff : CB_COLOR_CONTROL.R EG_CB_COLOR_CONTROL__ROP3_mask); } -static void evergreenClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq ) //same , but PA_CL_UCP_0_ offset diff +static void evergreenClipPlane( struct gl_context *ctx, GLenum plane, const GLfloat *eq ) //same , but PA_CL_UCP_0_ offset diff { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -549,7 +549,7 @@ static void evergreenClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq evergreen->ucp[p].PA_CL_UCP_0_W.u32All = ip[3]; } -static void evergreenSetClipPlaneState(GLcontext * ctx, GLenum cap, GLboolean state) //diff in func calls +static void evergreenSetClipPlaneState(struct gl_context * ctx, GLenum cap, GLboolean state) //diff in func calls { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -569,7 +569,7 @@ static void evergreenSetClipPlaneState(GLcontext * ctx, GLenum cap, GLboolean st } } -static void evergreenSetDBRenderState(GLcontext * ctx) +static void evergreenSetDBRenderState(struct gl_context * ctx) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -629,13 +629,13 @@ static void evergreenSetDBRenderState(GLcontext * ctx) } } -void evergreenUpdateShaderStates(GLcontext * ctx) +void evergreenUpdateShaderStates(struct gl_context * ctx) { evergreenSetDBRenderState(ctx); evergreenUpdateTextureState(ctx); } -static void evergreenSetDepthState(GLcontext * ctx) //same +static void evergreenSetDepthState(struct gl_context * ctx) //same { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -701,29 +701,30 @@ static void evergreenSetDepthState(GLcontext * ctx) //same } } -static void evergreenSetStencilState(GLcontext * ctx, GLboolean state) //same +static void evergreenSetStencilState(struct gl_context * ctx, GLboolean state) //same { - context_t *context = EVERGREEN_CONTEXT(ctx); - EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); - GLboolean hw_stencil = GL_FALSE; + context_t *context = EVERGREEN_CONTEXT(ctx); + EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); + GLboolean hw_stencil = GL_FALSE; - if (ctx->DrawBuffer) { - struct radeon_renderbuffer *rrbStencil - = radeon_get_renderbuffer(ctx->DrawBuffer, BUFFER_STENCIL); - hw_stencil = (rrbStencil && rrbStencil->bo); - } + if (ctx->DrawBuffer) { + struct radeon_renderbuffer *rrbStencil + = radeon_get_renderbuffer(ctx->DrawBuffer, BUFFER_STENCIL); + hw_stencil = (rrbStencil && rrbStencil->bo); + } - if (hw_stencil) { - EVERGREEN_STATECHANGE(context, db); - if (state) { - SETbit(evergreen->DB_DEPTH_CONTROL.u32All, STENCIL_ENABLE_bit); - SETbit(evergreen->DB_DEPTH_CONTROL.u32All, BACKFACE_ENABLE_bit); - } else - CLEARbit(evergreen->DB_DEPTH_CONTROL.u32All, STENCIL_ENABLE_bit); - } + if (hw_stencil) { + EVERGREEN_STATECHANGE(context, db); + if (state) { + SETbit(evergreen->DB_DEPTH_CONTROL.u32All, STENCIL_ENABLE_bit); + SETbit(evergreen->DB_DEPTH_CONTROL.u32All, BACKFACE_ENABLE_bit); + SETbit(evergreen->DB_STENCIL_INFO.u32All, EG_DB_STENCIL_INFO__FORMAT_bit); + } else + CLEARbit(evergreen->DB_DEPTH_CONTROL.u32All, STENCIL_ENABLE_bit); + } } -static void evergreenUpdateCulling(GLcontext * ctx) //same +static void evergreenUpdateCulling(struct gl_context * ctx) //same { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -775,7 +776,7 @@ static void evergreenUpdateCulling(GLcontext * ctx) //same evergreen->PA_SU_SC_MODE_CNTL.u32All ^= FACE_bit; } -static void evergreenSetPolygonOffsetState(GLcontext * ctx, GLboolean state) //same +static void evergreenSetPolygonOffsetState(struct gl_context * ctx, GLboolean state) //same { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -793,7 +794,7 @@ static void evergreenSetPolygonOffsetState(GLcontext * ctx, GLboolean state) //s } } -static void evergreenUpdateLineStipple(GLcontext * ctx) //diff +static void evergreenUpdateLineStipple(struct gl_context * ctx) //diff { /* TODO */ } @@ -912,7 +913,7 @@ void evergreenSetScissor(context_t *context) //diff evergreen->viewport[id].enabled = GL_TRUE; } -static void evergreenUpdateWindow(GLcontext * ctx, int id) //diff in calling evergreenSetScissor +static void evergreenUpdateWindow(struct gl_context * ctx, int id) //diff in calling evergreenSetScissor { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -968,7 +969,7 @@ static void evergreenUpdateWindow(GLcontext * ctx, int id) //diff in calling eve evergreenSetScissor(context); } -static void evergreenEnable(GLcontext * ctx, GLenum cap, GLboolean state) //diff in func calls +static void evergreenEnable(struct gl_context * ctx, GLenum cap, GLboolean state) //diff in func calls { context_t *context = EVERGREEN_CONTEXT(ctx); @@ -1029,7 +1030,7 @@ static void evergreenEnable(GLcontext * ctx, GLenum cap, GLboolean state) //diff } -static void evergreenColorMask(GLcontext * ctx, +static void evergreenColorMask(struct gl_context * ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a) //same { context_t *context = EVERGREEN_CONTEXT(ctx); @@ -1045,26 +1046,26 @@ static void evergreenColorMask(GLcontext * ctx, } } -static void evergreenDepthFunc(GLcontext * ctx, GLenum func) //same +static void evergreenDepthFunc(struct gl_context * ctx, GLenum func) //same { evergreenSetDepthState(ctx); } -static void evergreenDepthMask(GLcontext * ctx, GLboolean mask) //same +static void evergreenDepthMask(struct gl_context * ctx, GLboolean mask) //same { evergreenSetDepthState(ctx); } -static void evergreenCullFace(GLcontext * ctx, GLenum mode) //same +static void evergreenCullFace(struct gl_context * ctx, GLenum mode) //same { evergreenUpdateCulling(ctx); } -static void evergreenFogfv(GLcontext * ctx, GLenum pname, const GLfloat * param) //same +static void evergreenFogfv(struct gl_context * ctx, GLenum pname, const GLfloat * param) //same { } -static void evergreenUpdatePolygonMode(GLcontext * ctx) //same +static void evergreenUpdatePolygonMode(struct gl_context * ctx) //same { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -1119,13 +1120,13 @@ static void evergreenUpdatePolygonMode(GLcontext * ctx) //same } } -static void evergreenFrontFace(GLcontext * ctx, GLenum mode) //same +static void evergreenFrontFace(struct gl_context * ctx, GLenum mode) //same { evergreenUpdateCulling(ctx); evergreenUpdatePolygonMode(ctx); } -static void evergreenShadeModel(GLcontext * ctx, GLenum mode) //same +static void evergreenShadeModel(struct gl_context * ctx, GLenum mode) //same { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -1145,13 +1146,13 @@ static void evergreenShadeModel(GLcontext * ctx, GLenum mode) //same } } -static void evergreenLogicOpcode(GLcontext *ctx, GLenum logicop) //diff +static void evergreenLogicOpcode(struct gl_context *ctx, GLenum logicop) //diff { if (RGBA_LOGICOP_ENABLED(ctx)) evergreenSetLogicOpState(ctx); } -static void evergreenPointSize(GLcontext * ctx, GLfloat size) //same +static void evergreenPointSize(struct gl_context * ctx, GLfloat size) //same { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -1173,7 +1174,7 @@ static void evergreenPointSize(GLcontext * ctx, GLfloat size) //same } -static void evergreenPointParameter(GLcontext * ctx, GLenum pname, const GLfloat * param) //same +static void evergreenPointParameter(struct gl_context * ctx, GLenum pname, const GLfloat * param) //same { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -1224,7 +1225,7 @@ static int evergreen_translate_stencil_func(int func) //same return 0; } -static void evergreenStencilFuncSeparate(GLcontext * ctx, GLenum face, +static void evergreenStencilFuncSeparate(struct gl_context * ctx, GLenum face, GLenum func, GLint ref, GLuint mask) //same { context_t *context = EVERGREEN_CONTEXT(ctx); @@ -1253,7 +1254,7 @@ static void evergreenStencilFuncSeparate(GLcontext * ctx, GLenum face, STENCILFUNC_BF_shift, STENCILFUNC_BF_mask); } -static void evergreenStencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask) //same +static void evergreenStencilMaskSeparate(struct gl_context * ctx, GLenum face, GLuint mask) //same { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -1297,7 +1298,7 @@ static int evergreen_translate_stencil_op(int op) //same return 0; } -static void evergreenStencilOpSeparate(GLcontext * ctx, GLenum face, +static void evergreenStencilOpSeparate(struct gl_context * ctx, GLenum face, GLenum fail, GLenum zfail, GLenum zpass) //same { context_t *context = EVERGREEN_CONTEXT(ctx); @@ -1321,7 +1322,7 @@ static void evergreenStencilOpSeparate(GLcontext * ctx, GLenum face, STENCILZPASS_BF_shift, STENCILZPASS_BF_mask); } -static void evergreenViewport(GLcontext * ctx, +static void evergreenViewport(struct gl_context * ctx, GLint x, GLint y, GLsizei width, @@ -1332,12 +1333,12 @@ static void evergreenViewport(GLcontext * ctx, radeon_viewport(ctx, x, y, width, height); } -static void evergreenDepthRange(GLcontext * ctx, GLclampd nearval, GLclampd farval) //diff in evergreenUpdateWindow +static void evergreenDepthRange(struct gl_context * ctx, GLclampd nearval, GLclampd farval) //diff in evergreenUpdateWindow { evergreenUpdateWindow(ctx, 0); } -static void evergreenLineWidth(GLcontext * ctx, GLfloat widthf) //same +static void evergreenLineWidth(struct gl_context * ctx, GLfloat widthf) //same { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -1351,7 +1352,7 @@ static void evergreenLineWidth(GLcontext * ctx, GLfloat widthf) //same PA_SU_LINE_CNTL__WIDTH_shift, PA_SU_LINE_CNTL__WIDTH_mask); } -static void evergreenLineStipple(GLcontext *ctx, GLint factor, GLushort pattern) //same +static void evergreenLineStipple(struct gl_context *ctx, GLint factor, GLushort pattern) //same { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -1363,7 +1364,7 @@ static void evergreenLineStipple(GLcontext *ctx, GLint factor, GLushort pattern) SETfield(evergreen->PA_SC_LINE_STIPPLE.u32All, 1, AUTO_RESET_CNTL_shift, AUTO_RESET_CNTL_mask); } -static void evergreenPolygonOffset(GLcontext * ctx, GLfloat factor, GLfloat units) //diff : +static void evergreenPolygonOffset(struct gl_context * ctx, GLfloat factor, GLfloat units) //diff : //all register here offset diff, bits same { context_t *context = EVERGREEN_CONTEXT(ctx); @@ -1394,7 +1395,7 @@ static void evergreenPolygonOffset(GLcontext * ctx, GLfloat factor, GLfloat unit evergreen->PA_SU_POLY_OFFSET_BACK_OFFSET.f32All = constant; } -static void evergreenPolygonMode(GLcontext * ctx, GLenum face, GLenum mode) //same +static void evergreenPolygonMode(struct gl_context * ctx, GLenum face, GLenum mode) //same { (void)face; (void)mode; @@ -1402,12 +1403,12 @@ static void evergreenPolygonMode(GLcontext * ctx, GLenum face, GLenum mode) //sa evergreenUpdatePolygonMode(ctx); } -static void evergreenRenderMode(GLcontext * ctx, GLenum mode) //same +static void evergreenRenderMode(struct gl_context * ctx, GLenum mode) //same { } //TODO : move to kernel. -static void evergreenInitSQConfig(GLcontext * ctx) +static void evergreenInitSQConfig(struct gl_context * ctx) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -1607,7 +1608,7 @@ static void evergreenInitSQConfig(GLcontext * ctx) NUM_CLIP_SEQ_mask); } -void evergreenInitState(GLcontext * ctx) //diff +void evergreenInitState(struct gl_context * ctx) //diff { context_t *context = R700_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -1699,7 +1700,7 @@ void evergreenInitState(GLcontext * ctx) //diff evergreen->DB_STENCIL_INFO.u32All = 0; CLEARbit(evergreen->DB_STENCIL_INFO.u32All, EG_DB_STENCIL_INFO__FORMAT_bit); - SETfield(evergreen->DB_STENCIL_INFO.u32All, EG_ADDR_SURF_TILE_SPLIT_256B, + SETfield(evergreen->DB_STENCIL_INFO.u32All, 0, EG_DB_STENCIL_INFO__TILE_SPLIT_shift, EG_DB_STENCIL_INFO__TILE_SPLIT_mask); evergreen->DB_RENDER_CONTROL.u32All = 0; @@ -1709,6 +1710,15 @@ void evergreenInitState(GLcontext * ctx) //diff SETfield(evergreen->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIS_ENABLE0_shift, FORCE_HIS_ENABLE0_mask); SETfield(evergreen->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIS_ENABLE1_shift, FORCE_HIS_ENABLE1_mask); + /* stencil */ + evergreenEnable(ctx, GL_STENCIL_TEST, ctx->Stencil._Enabled); + evergreenStencilMaskSeparate(ctx, 0, ctx->Stencil.WriteMask[0]); + evergreenStencilFuncSeparate(ctx, 0, ctx->Stencil.Function[0], + ctx->Stencil.Ref[0], ctx->Stencil.ValueMask[0]); + evergreenStencilOpSeparate(ctx, 0, ctx->Stencil.FailFunc[0], + ctx->Stencil.ZFailFunc[0], + ctx->Stencil.ZPassFunc[0]); + // Disable ROP3 modes by setting src to dst copy: SETfield(evergreen->CB_COLOR_CONTROL.u32All, 0xCC, EG_CB_COLOR_CONTROL__ROP3_shift, diff --git a/src/mesa/drivers/dri/r600/evergreen_state.h b/src/mesa/drivers/dri/r600/evergreen_state.h index ffdb56b38a..2f350e90fa 100644 --- a/src/mesa/drivers/dri/r600/evergreen_state.h +++ b/src/mesa/drivers/dri/r600/evergreen_state.h @@ -31,15 +31,15 @@ #include "r600_context.h" -extern void evergreenUpdateStateParameters(GLcontext * ctx, GLuint new_state); -extern void evergreenUpdateShaders(GLcontext * ctx); -extern void evergreenUpdateShaderStates(GLcontext * ctx); +extern void evergreenUpdateStateParameters(struct gl_context * ctx, GLuint new_state); +extern void evergreenUpdateShaders(struct gl_context * ctx); +extern void evergreenUpdateShaderStates(struct gl_context * ctx); -extern void evergreeUpdateShaders(GLcontext * ctx); +extern void evergreeUpdateShaders(struct gl_context * ctx); -extern void evergreenUpdateViewportOffset(GLcontext * ctx); +extern void evergreenUpdateViewportOffset(struct gl_context * ctx); -extern void evergreenInitState(GLcontext * ctx); +extern void evergreenInitState(struct gl_context * ctx); extern void evergreenInitStateFuncs (radeonContextPtr radeon, struct dd_function_table *functions); extern void evergreenSetScissor(context_t *context); diff --git a/src/mesa/drivers/dri/r600/evergreen_tex.c b/src/mesa/drivers/dri/r600/evergreen_tex.c index 8b42045ebb..58420ed123 100644 --- a/src/mesa/drivers/dri/r600/evergreen_tex.c +++ b/src/mesa/drivers/dri/r600/evergreen_tex.c @@ -934,7 +934,7 @@ EG_S_FIXED(float value, uint32_t frac_bits) return value * (1 << frac_bits); } -static GLboolean evergreen_setup_hardware_state(GLcontext * ctx, struct gl_texture_object *texObj, int unit) +static GLboolean evergreen_setup_hardware_state(struct gl_context * ctx, struct gl_texture_object *texObj, int unit) { context_t *context = EVERGREEN_CONTEXT(ctx); radeonTexObj *t = radeon_tex_obj(texObj); @@ -1289,7 +1289,7 @@ void evergreenSetTexBuffer(__DRIcontext *pDRICtx, GLint target, GLint glx_textur return; } -void evergreenUpdateTextureState(GLcontext * ctx) +void evergreenUpdateTextureState(struct gl_context * ctx) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT * evergreen = GET_EVERGREEN_CHIP(context); @@ -1311,7 +1311,7 @@ void evergreenUpdateTextureState(GLcontext * ctx) } } -static GLboolean evergreen_validate_texture(GLcontext * ctx, struct gl_texture_object *texObj, int unit) +static GLboolean evergreen_validate_texture(struct gl_context * ctx, struct gl_texture_object *texObj, int unit) { radeonTexObj *t = radeon_tex_obj(texObj); @@ -1327,7 +1327,7 @@ static GLboolean evergreen_validate_texture(GLcontext * ctx, struct gl_texture_o return GL_TRUE; } -GLboolean evergreenValidateBuffers(GLcontext * ctx) +GLboolean evergreenValidateBuffers(struct gl_context * ctx) { context_t *rmesa = EVERGREEN_CONTEXT(ctx); struct radeon_renderbuffer *rrb; @@ -1403,7 +1403,7 @@ GLboolean evergreenValidateBuffers(GLcontext * ctx) return GL_TRUE; } -static struct gl_texture_object *evergreenNewTextureObject(GLcontext * ctx, +static struct gl_texture_object *evergreenNewTextureObject(struct gl_context * ctx, GLuint name, GLenum target) { @@ -1426,7 +1426,7 @@ static struct gl_texture_object *evergreenNewTextureObject(GLcontext * ctx, return &t->base; } -static void evergreenDeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj) +static void evergreenDeleteTexture(struct gl_context * ctx, struct gl_texture_object *texObj) { context_t * rmesa = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT * evergreen = GET_EVERGREEN_CHIP(rmesa); @@ -1456,7 +1456,7 @@ static void evergreenDeleteTexture(GLcontext * ctx, struct gl_texture_object *te _mesa_delete_texture_object(ctx, texObj); } -static void evergreenTexParameter(GLcontext * ctx, GLenum target, +static void evergreenTexParameter(struct gl_context * ctx, GLenum target, struct gl_texture_object *texObj, GLenum pname, const GLfloat * params) { diff --git a/src/mesa/drivers/dri/r600/evergreen_tex.h b/src/mesa/drivers/dri/r600/evergreen_tex.h index b43508a9ea..982a087f8e 100644 --- a/src/mesa/drivers/dri/r600/evergreen_tex.h +++ b/src/mesa/drivers/dri/r600/evergreen_tex.h @@ -27,9 +27,9 @@ #ifndef _EVERGREEN_TEX_H_ #define _EVERGREEN_TEX_H_ -extern GLboolean evergreenValidateBuffers(GLcontext * ctx); +extern GLboolean evergreenValidateBuffers(struct gl_context * ctx); -extern void evergreenUpdateTextureState(GLcontext * ctx); +extern void evergreenUpdateTextureState(struct gl_context * ctx); extern void evergreenInitTextureFuncs(radeonContextPtr radeon, struct dd_function_table *functions); extern void evergreenSetTexOffset(__DRIcontext * pDRICtx, GLint texname, unsigned long long offset, GLint depth, GLuint pitch); diff --git a/src/mesa/drivers/dri/r600/evergreen_vertprog.c b/src/mesa/drivers/dri/r600/evergreen_vertprog.c index 6840fa3c86..b3371f20b1 100644 --- a/src/mesa/drivers/dri/r600/evergreen_vertprog.c +++ b/src/mesa/drivers/dri/r600/evergreen_vertprog.c @@ -169,7 +169,7 @@ GLboolean evergreen_Process_Vertex_Program_Vfetch_Instructions( } GLboolean evergreen_Process_Vertex_Program_Vfetch_Instructions2( - GLcontext *ctx, + struct gl_context *ctx, struct evergreen_vertex_program *vp, struct gl_vertex_program *mesa_vp) { @@ -196,7 +196,7 @@ GLboolean evergreen_Process_Vertex_Program_Vfetch_Instructions2( return GL_TRUE; } -void evergreen_Map_Vertex_Program(GLcontext *ctx, +void evergreen_Map_Vertex_Program(struct gl_context *ctx, struct evergreen_vertex_program *vp, struct gl_vertex_program *mesa_vp) { @@ -292,7 +292,7 @@ GLboolean evergreen_Find_Instruction_Dependencies_vp(struct evergreen_vertex_pro return GL_TRUE; } -struct evergreen_vertex_program* evergreenTranslateVertexShader(GLcontext *ctx, +struct evergreen_vertex_program* evergreenTranslateVertexShader(struct gl_context *ctx, struct gl_vertex_program *mesa_vp) { context_t *context = EVERGREEN_CONTEXT(ctx); @@ -374,7 +374,7 @@ struct evergreen_vertex_program* evergreenTranslateVertexShader(GLcontext *ctx, return vp; } -void evergreenSelectVertexShader(GLcontext *ctx) +void evergreenSelectVertexShader(struct gl_context *ctx) { context_t *context = EVERGREEN_CONTEXT(ctx); struct evergreen_vertex_program_cont *vpc; @@ -448,7 +448,7 @@ int evergreen_getTypeSize(GLenum type) } } -static void evergreenTranslateAttrib(GLcontext *ctx, GLuint unLoc, int count, const struct gl_client_array *input) +static void evergreenTranslateAttrib(struct gl_context *ctx, GLuint unLoc, int count, const struct gl_client_array *input) { context_t *context = EVERGREEN_CONTEXT(ctx); @@ -459,11 +459,11 @@ static void evergreenTranslateAttrib(GLcontext *ctx, GLuint unLoc, int count, co stride = (input->StrideB == 0) ? evergreen_getTypeSize(input->Type) * input->Size : input->StrideB; - if (input->Type == GL_DOUBLE || input->Type == GL_UNSIGNED_INT || input->Type == GL_INT || + if (input->Type == GL_DOUBLE || input->Type == GL_UNSIGNED_INT || input->Type == GL_INT #if MESA_BIG_ENDIAN - evergreen_getTypeSize(input->Type) != 4 || + || evergreen_getTypeSize(input->Type) != 4 #endif - stride < 4) + ) { pStreamDesc->type = GL_FLOAT; @@ -534,7 +534,7 @@ static void evergreenTranslateAttrib(GLcontext *ctx, GLuint unLoc, int count, co context->nNumActiveAos++; } -void evergreenSetVertexFormat(GLcontext *ctx, const struct gl_client_array *arrays[], int count) +void evergreenSetVertexFormat(struct gl_context *ctx, const struct gl_client_array *arrays[], int count) { context_t *context = EVERGREEN_CONTEXT(ctx); struct evergreen_vertex_program *vpc @@ -563,7 +563,7 @@ void evergreenSetVertexFormat(GLcontext *ctx, const struct gl_client_array *arra context->radeon.tcl.aos_count = context->nNumActiveAos; } -void * evergreenGetActiveVpShaderBo(GLcontext * ctx) +void * evergreenGetActiveVpShaderBo(struct gl_context * ctx) { context_t *context = EVERGREEN_CONTEXT(ctx); struct evergreen_vertex_program *vp = context->selected_vp;; @@ -574,7 +574,7 @@ void * evergreenGetActiveVpShaderBo(GLcontext * ctx) return NULL; } -void * evergreenGetActiveVpShaderConstBo(GLcontext * ctx) +void * evergreenGetActiveVpShaderConstBo(struct gl_context * ctx) { context_t *context = EVERGREEN_CONTEXT(ctx); struct evergreen_vertex_program *vp = context->selected_vp;; @@ -585,7 +585,7 @@ void * evergreenGetActiveVpShaderConstBo(GLcontext * ctx) return NULL; } -GLboolean evergreenSetupVertexProgram(GLcontext * ctx) +GLboolean evergreenSetupVertexProgram(struct gl_context * ctx) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); @@ -646,7 +646,7 @@ GLboolean evergreenSetupVertexProgram(GLcontext * ctx) return GL_TRUE; } -GLboolean evergreenSetupVPconstants(GLcontext * ctx) +GLboolean evergreenSetupVPconstants(struct gl_context * ctx) { context_t *context = EVERGREEN_CONTEXT(ctx); EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context); diff --git a/src/mesa/drivers/dri/r600/evergreen_vertprog.h b/src/mesa/drivers/dri/r600/evergreen_vertprog.h index 5853902115..8163e36927 100644 --- a/src/mesa/drivers/dri/r600/evergreen_vertprog.h +++ b/src/mesa/drivers/dri/r600/evergreen_vertprog.h @@ -80,29 +80,29 @@ GLboolean evergreen_Process_Vertex_Program_Vfetch_Instructions( struct evergreen_vertex_program *vp, struct gl_vertex_program *mesa_vp); GLboolean evergreen_Process_Vertex_Program_Vfetch_Instructions2( - GLcontext *ctx, + struct gl_context *ctx, struct evergreen_vertex_program *vp, struct gl_vertex_program *mesa_vp); -void evergreen_Map_Vertex_Program(GLcontext *ctx, +void evergreen_Map_Vertex_Program(struct gl_context *ctx, struct evergreen_vertex_program *vp, struct gl_vertex_program *mesa_vp); GLboolean evergreen_Find_Instruction_Dependencies_vp(struct evergreen_vertex_program *vp, struct gl_vertex_program *mesa_vp); -struct evergreen_vertex_program* evergreenTranslateVertexShader(GLcontext *ctx, +struct evergreen_vertex_program* evergreenTranslateVertexShader(struct gl_context *ctx, struct gl_vertex_program *mesa_vp); /* Interface */ -extern void evergreenSelectVertexShader(GLcontext *ctx); -extern void evergreenSetVertexFormat(GLcontext *ctx, const struct gl_client_array *arrays[], int count); +extern void evergreenSelectVertexShader(struct gl_context *ctx); +extern void evergreenSetVertexFormat(struct gl_context *ctx, const struct gl_client_array *arrays[], int count); -extern GLboolean evergreenSetupVertexProgram(GLcontext * ctx); +extern GLboolean evergreenSetupVertexProgram(struct gl_context * ctx); -extern GLboolean evergreenSetupVPconstants(GLcontext * ctx); +extern GLboolean evergreenSetupVPconstants(struct gl_context * ctx); -extern void * evergreenGetActiveVpShaderBo(GLcontext * ctx); +extern void * evergreenGetActiveVpShaderBo(struct gl_context * ctx); -extern void * evergreenGetActiveVpShaderConstBo(GLcontext * ctx); +extern void * evergreenGetActiveVpShaderConstBo(struct gl_context * ctx); extern int evergreen_getTypeSize(GLenum type); diff --git a/src/mesa/drivers/dri/r600/r600_blit.c b/src/mesa/drivers/dri/r600/r600_blit.c index 3090c9f613..31c32d62f9 100644 --- a/src/mesa/drivers/dri/r600/r600_blit.c +++ b/src/mesa/drivers/dri/r600/r600_blit.c @@ -408,7 +408,7 @@ set_render_target(context_t *context, struct radeon_bo *bo, gl_format mesa_forma } -static inline void load_shaders(GLcontext * ctx) +static inline void load_shaders(struct gl_context * ctx) { radeonContextPtr radeonctx = RADEON_CONTEXT(ctx); @@ -1566,7 +1566,7 @@ static GLboolean validate_buffers(context_t *rmesa, return GL_TRUE; } -unsigned r600_blit(GLcontext *ctx, +unsigned r600_blit(struct gl_context *ctx, struct radeon_bo *src_bo, intptr_t src_offset, gl_format src_mesaformat, diff --git a/src/mesa/drivers/dri/r600/r600_blit.h b/src/mesa/drivers/dri/r600/r600_blit.h index d56b21ba9b..9dc8e2fec6 100644 --- a/src/mesa/drivers/dri/r600/r600_blit.h +++ b/src/mesa/drivers/dri/r600/r600_blit.h @@ -30,7 +30,7 @@ unsigned r600_check_blit(gl_format mesa_format); -unsigned r600_blit(GLcontext *ctx, +unsigned r600_blit(struct gl_context *ctx, struct radeon_bo *src_bo, intptr_t src_offset, gl_format src_mesaformat, diff --git a/src/mesa/drivers/dri/r600/r600_cmdbuf.c b/src/mesa/drivers/dri/r600/r600_cmdbuf.c index b3331fc8b8..ce2f777956 100644 --- a/src/mesa/drivers/dri/r600/r600_cmdbuf.c +++ b/src/mesa/drivers/dri/r600/r600_cmdbuf.c @@ -47,7 +47,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "radeon_reg.h" #include "r600_cmdbuf.h" #include "radeon_bocs_wrapper.h" -#include "radeon_reg.h" #ifdef HAVE_LIBDRM_RADEON #include "radeon_cs_int.h" diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index 9c8fe2a24f..c882a9cce9 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -146,7 +146,6 @@ static const struct dri_extension card_extensions[] = { {"GL_MESAX_texture_float", NULL}, {"GL_NV_blend_square", NULL}, {"GL_NV_vertex_program", GL_NV_vertex_program_functions}, - {"GL_SGIS_generate_mipmap", NULL}, {"GL_ARB_pixel_buffer_object", NULL}, {"GL_ARB_draw_elements_base_vertex", GL_ARB_draw_elements_base_vertex_functions }, {NULL, NULL} @@ -166,7 +165,6 @@ static const struct dri_extension mm_extensions[] = { static const struct dri_extension gl_20_extension[] = { #ifdef R600_ENABLE_GLSL_TEST {"GL_ARB_shading_language_100", GL_VERSION_2_0_functions }, - {"GL_ARB_shading_language_120", GL_VERSION_2_1_functions }, #else {"GL_VERSION_2_0", GL_VERSION_2_0_functions }, #endif /* R600_ENABLE_GLSL_TEST */ @@ -210,7 +208,7 @@ static void r600_vtbl_pre_emit_atoms(radeonContextPtr radeon) r700Start3D((context_t *)radeon); } -static void r600_fallback(GLcontext *ctx, GLuint bit, GLboolean mode) +static void r600_fallback(struct gl_context *ctx, GLuint bit, GLboolean mode) { context_t *context = R700_CONTEXT(ctx); if (mode) @@ -251,7 +249,7 @@ static void r600_init_vtbl(radeonContextPtr radeon) radeon->vtbl.is_format_renderable = r600IsFormatRenderable; } -static void r600InitConstValues(GLcontext *ctx, radeonScreenPtr screen) +static void r600InitConstValues(struct gl_context *ctx, radeonScreenPtr screen) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -266,6 +264,8 @@ static void r600InitConstValues(GLcontext *ctx, radeonScreenPtr screen) r700->bShaderUseMemConstant = GL_FALSE; } + ctx->Const.GLSLVersion = 120; + ctx->Const.MaxTextureImageUnits = 16; /* 8 per clause on r6xx, 16 on r7xx * but I think mesa only supports 8 at the moment @@ -335,7 +335,7 @@ static void r600ParseOptions(context_t *r600, radeonScreenPtr screen) } -static void r600InitGLExtensions(GLcontext *ctx) +static void r600InitGLExtensions(struct gl_context *ctx) { context_t *r600 = R700_CONTEXT(ctx); #ifdef R600_ENABLE_GLSL_TEST @@ -380,7 +380,7 @@ static void r600InitGLExtensions(GLcontext *ctx) /* Create the device specific rendering context. */ GLboolean r600CreateContext(gl_api api, - const __GLcontextModes * glVisual, + const struct gl_config * glVisual, __DRIcontext * driContextPriv, void *sharedContextPrivate) { @@ -388,7 +388,7 @@ GLboolean r600CreateContext(gl_api api, radeonScreenPtr screen = (radeonScreenPtr) (sPriv->private); struct dd_function_table functions; context_t *r600; - GLcontext *ctx; + struct gl_context *ctx; assert(glVisual); assert(driContextPriv); diff --git a/src/mesa/drivers/dri/r600/r600_context.h b/src/mesa/drivers/dri/r600/r600_context.h index 6a83196648..d3dc901acf 100644 --- a/src/mesa/drivers/dri/r600/r600_context.h +++ b/src/mesa/drivers/dri/r600/r600_context.h @@ -188,12 +188,12 @@ struct r600_context { #define EVERGREEN_CONTEXT(ctx) ((context_t *)(ctx->DriverCtx)) #define R700_CONTEXT(ctx) ((context_t *)(ctx->DriverCtx)) -#define GL_CONTEXT(context) ((GLcontext *)(context->radeon.glCtx)) +#define GL_CONTEXT(context) ((struct gl_context *)(context->radeon.glCtx)) #define GET_EVERGREEN_CHIP(context) ((EVERGREEN_CHIP_CONTEXT*)(context->pChip)) extern GLboolean r600CreateContext(gl_api api, - const __GLcontextModes * glVisual, + const struct gl_config * glVisual, __DRIcontext * driContextPriv, void *sharedContextPrivate); @@ -232,10 +232,10 @@ extern void r700WaitForIdleClean(context_t *context); extern void r700Start3D(context_t *context); extern void r600InitAtoms(context_t *context); -extern void r700InitDraw(GLcontext *ctx); +extern void r700InitDraw(struct gl_context *ctx); extern void evergreenInitAtoms(context_t *context); -extern void evergreenInitDraw(GLcontext *ctx); +extern void evergreenInitDraw(struct gl_context *ctx); #define RADEON_D_CAPTURE 0 #define RADEON_D_PLAYBACK 1 diff --git a/src/mesa/drivers/dri/r600/r600_emit.c b/src/mesa/drivers/dri/r600/r600_emit.c index a840106c14..53ece9a350 100644 --- a/src/mesa/drivers/dri/r600/r600_emit.c +++ b/src/mesa/drivers/dri/r600/r600_emit.c @@ -49,7 +49,7 @@ void r600EmitCacheFlush(context_t *rmesa) { } -GLboolean r600AllocShaderConsts(GLcontext * ctx, +GLboolean r600AllocShaderConsts(struct gl_context * ctx, void ** constbo, int sizeinBYTE, char * szShaderUsage) @@ -93,7 +93,7 @@ shader_again_alloc: return GL_TRUE; } -GLboolean r600EmitShaderConsts(GLcontext * ctx, +GLboolean r600EmitShaderConsts(struct gl_context * ctx, void * constbo, int bo_offset, GLvoid * data, @@ -114,7 +114,7 @@ GLboolean r600EmitShaderConsts(GLcontext * ctx, return GL_TRUE; } -GLboolean r600EmitShader(GLcontext * ctx, +GLboolean r600EmitShader(struct gl_context * ctx, void ** shaderbo, GLvoid * data, int sizeinDWORD, @@ -163,7 +163,7 @@ shader_again_alloc: return GL_TRUE; } -GLboolean r600DeleteShader(GLcontext * ctx, +GLboolean r600DeleteShader(struct gl_context * ctx, void * shaderbo) { struct radeon_bo * pbo = (struct radeon_bo *)shaderbo; diff --git a/src/mesa/drivers/dri/r600/r600_emit.h b/src/mesa/drivers/dri/r600/r600_emit.h index 259561539f..c50b6060ca 100644 --- a/src/mesa/drivers/dri/r600/r600_emit.h +++ b/src/mesa/drivers/dri/r600/r600_emit.h @@ -43,20 +43,20 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. void r600EmitCacheFlush(context_t *rmesa); -extern GLboolean r600EmitShader(GLcontext * ctx, +extern GLboolean r600EmitShader(struct gl_context * ctx, void ** shaderbo, GLvoid * data, int sizeinDWORD, char * szShaderUsage); -extern GLboolean r600DeleteShader(GLcontext * ctx, +extern GLboolean r600DeleteShader(struct gl_context * ctx, void * shaderbo); -extern GLboolean r600AllocShaderConsts(GLcontext * ctx, +extern GLboolean r600AllocShaderConsts(struct gl_context * ctx, void ** constbo, int sizeinBYTE, char * szShaderUsage); -GLboolean r600EmitShaderConsts(GLcontext * ctx, +GLboolean r600EmitShaderConsts(struct gl_context * ctx, void * constbo, int bo_offset, GLvoid * data, diff --git a/src/mesa/drivers/dri/r600/r600_tex.c b/src/mesa/drivers/dri/r600/r600_tex.c index 512a52ede3..d6a58f410c 100644 --- a/src/mesa/drivers/dri/r600/r600_tex.c +++ b/src/mesa/drivers/dri/r600/r600_tex.c @@ -276,7 +276,7 @@ static void r600SetTexBorderColor(radeonTexObjPtr t, const GLfloat color[4]) * next UpdateTextureState */ -static void r600TexParameter(GLcontext * ctx, GLenum target, +static void r600TexParameter(struct gl_context * ctx, GLenum target, struct gl_texture_object *texObj, GLenum pname, const GLfloat * params) { @@ -332,7 +332,7 @@ static void r600TexParameter(GLcontext * ctx, GLenum target, } } -static void r600DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj) +static void r600DeleteTexture(struct gl_context * ctx, struct gl_texture_object *texObj) { context_t* rmesa = R700_CONTEXT(ctx); radeonTexObj* t = radeon_tex_obj(texObj); @@ -368,7 +368,7 @@ static void r600DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj) * allocate the default texture objects. * Fixup MaxAnisotropy according to user preference. */ -static struct gl_texture_object *r600NewTextureObject(GLcontext * ctx, +static struct gl_texture_object *r600NewTextureObject(struct gl_context * ctx, GLuint name, GLenum target) { diff --git a/src/mesa/drivers/dri/r600/r600_tex.h b/src/mesa/drivers/dri/r600/r600_tex.h index 771affdfa6..256588429e 100644 --- a/src/mesa/drivers/dri/r600/r600_tex.h +++ b/src/mesa/drivers/dri/r600/r600_tex.h @@ -56,7 +56,7 @@ extern void r600SetTexOffset(__DRIcontext *pDRICtx, GLint texname, unsigned long long offset, GLint depth, GLuint pitch); -extern GLboolean r600ValidateBuffers(GLcontext * ctx); +extern GLboolean r600ValidateBuffers(struct gl_context * ctx); extern void r600InitTextureFuncs(radeonContextPtr radeon, struct dd_function_table *functions); diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c index fd928cfe5d..3869768bf0 100644 --- a/src/mesa/drivers/dri/r600/r600_texstate.c +++ b/src/mesa/drivers/dri/r600/r600_texstate.c @@ -52,9 +52,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "evergreen_tex.h" -void r600UpdateTextureState(GLcontext * ctx); +void r600UpdateTextureState(struct gl_context * ctx); -void r600UpdateTextureState(GLcontext * ctx) +void r600UpdateTextureState(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -707,7 +707,7 @@ void r600SetDepthTexMode(struct gl_texture_object *tObj) * \param rmesa Context pointer * \param t the r300 texture object */ -static GLboolean setup_hardware_state(GLcontext * ctx, struct gl_texture_object *texObj, int unit) +static GLboolean setup_hardware_state(struct gl_context * ctx, struct gl_texture_object *texObj, int unit) { context_t *rmesa = R700_CONTEXT(ctx); radeonTexObj *t = radeon_tex_obj(texObj); @@ -803,7 +803,7 @@ static GLboolean setup_hardware_state(GLcontext * ctx, struct gl_texture_object * * Mostly this means populating the texture object's mipmap tree. */ -static GLboolean r600_validate_texture(GLcontext * ctx, struct gl_texture_object *texObj, int unit) +static GLboolean r600_validate_texture(struct gl_context * ctx, struct gl_texture_object *texObj, int unit) { radeonTexObj *t = radeon_tex_obj(texObj); @@ -822,7 +822,7 @@ static GLboolean r600_validate_texture(GLcontext * ctx, struct gl_texture_object /** * Ensure all enabled and complete textures are uploaded along with any buffers being used. */ -GLboolean r600ValidateBuffers(GLcontext * ctx) +GLboolean r600ValidateBuffers(struct gl_context * ctx) { context_t *rmesa = R700_CONTEXT(ctx); struct radeon_renderbuffer *rrb; diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c index 3bb194eb6d..4ec2845ab4 100644 --- a/src/mesa/drivers/dri/r600/r700_chip.c +++ b/src/mesa/drivers/dri/r600/r700_chip.c @@ -39,7 +39,7 @@ #include "radeon_mipmap_tree.h" -static void r700SendTexState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendTexState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -104,7 +104,7 @@ static void r700SendTexState(GLcontext *ctx, struct radeon_state_atom *atom) #define SAMPLER_STRIDE 3 -static void r700SendTexSamplerState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendTexSamplerState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -141,7 +141,7 @@ static void r700SendTexSamplerState(GLcontext *ctx, struct radeon_state_atom *at } } -static void r700SendTexBorderColorState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendTexBorderColorState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -167,7 +167,7 @@ static void r700SendTexBorderColorState(GLcontext *ctx, struct radeon_state_atom } extern int getTypeSize(GLenum type); -static void r700SetupVTXConstants(GLcontext * ctx, +static void r700SetupVTXConstants(struct gl_context * ctx, void * pAos, StreamDesc * pStreamDesc) { @@ -243,7 +243,7 @@ static void r700SetupVTXConstants(GLcontext * ctx, } -static void r700SendVTXState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendVTXState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); struct r700_vertex_program *vp = context->selected_vp; @@ -599,7 +599,7 @@ static void r700SetDepthTarget(context_t *context) /* r700->DB_PREFETCH_LIMIT.bits.DEPTH_HEIGHT_TILE_MAX = (context->currentDraw->h >> 3) - 1; */ /* z buffer sie may much bigger than what need, so use actual used h. */ } -static void r700SendDepthTargetState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendDepthTargetState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -646,7 +646,7 @@ static void r700SendDepthTargetState(GLcontext *ctx, struct radeon_state_atom *a } -static void r700SendRenderTargetState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendRenderTargetState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -724,7 +724,7 @@ static void r700SendRenderTargetState(GLcontext *ctx, struct radeon_state_atom * } -static void r700SendPSState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendPSState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -766,7 +766,7 @@ static void r700SendPSState(GLcontext *ctx, struct radeon_state_atom *atom) } -static void r700SendVSState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendVSState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -827,7 +827,7 @@ static void r700SendVSState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendFSState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendFSState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -869,7 +869,7 @@ static void r700SendFSState(GLcontext *ctx, struct radeon_state_atom *atom) } -static void r700SendViewportState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendViewportState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -903,7 +903,7 @@ static void r700SendViewportState(GLcontext *ctx, struct radeon_state_atom *atom } -static void r700SendSQConfig(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendSQConfig(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -940,7 +940,7 @@ static void r700SendSQConfig(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendUCPState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendUCPState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -962,7 +962,7 @@ static void r700SendUCPState(GLcontext *ctx, struct radeon_state_atom *atom) } } -static void r700SendSPIState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendSPIState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1037,7 +1037,7 @@ static void r700SendSPIState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendVGTState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendVGTState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1083,7 +1083,7 @@ static void r700SendVGTState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendSXState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendSXState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1098,7 +1098,7 @@ static void r700SendSXState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendDBState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendDBState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1124,7 +1124,7 @@ static void r700SendDBState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendStencilState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendStencilState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1138,7 +1138,7 @@ static void r700SendStencilState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendCBState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendCBState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1168,7 +1168,7 @@ static void r700SendCBState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendCBCLRCMPState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendCBCLRCMPState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1184,7 +1184,7 @@ static void r700SendCBCLRCMPState(GLcontext *ctx, struct radeon_state_atom *atom COMMIT_BATCH(); } -static void r700SendCBBlendState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendCBBlendState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1216,7 +1216,7 @@ static void r700SendCBBlendState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendCBBlendColorState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendCBBlendColorState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1233,7 +1233,7 @@ static void r700SendCBBlendColorState(GLcontext *ctx, struct radeon_state_atom * COMMIT_BATCH(); } -static void r700SendSUState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendSUState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1251,7 +1251,7 @@ static void r700SendSUState(GLcontext *ctx, struct radeon_state_atom *atom) } -static void r700SendPolyState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendPolyState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1271,7 +1271,7 @@ static void r700SendPolyState(GLcontext *ctx, struct radeon_state_atom *atom) } -static void r700SendCLState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendCLState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1287,7 +1287,7 @@ static void r700SendCLState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendGBState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendGBState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1303,7 +1303,7 @@ static void r700SendGBState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendScissorState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendScissorState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1336,7 +1336,7 @@ static void r700SendScissorState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendSCState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendSCState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1353,7 +1353,7 @@ static void r700SendSCState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendAAState(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendAAState(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1368,7 +1368,7 @@ static void r700SendAAState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendPSConsts(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendPSConsts(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1392,7 +1392,7 @@ static void r700SendPSConsts(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendVSConsts(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendVSConsts(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); @@ -1417,7 +1417,7 @@ static void r700SendVSConsts(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } -static void r700SendQueryBegin(GLcontext *ctx, struct radeon_state_atom *atom) +static void r700SendQueryBegin(struct gl_context *ctx, struct radeon_state_atom *atom) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); struct radeon_query_object *query = radeon->query.current; @@ -1443,12 +1443,12 @@ static void r700SendQueryBegin(GLcontext *ctx, struct radeon_state_atom *atom) query->emitted_begin = GL_TRUE; } -static int check_always(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_always(struct gl_context *ctx, struct radeon_state_atom *atom) { return atom->cmd_size; } -static int check_cb(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_cb(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); int count = 7; @@ -1460,7 +1460,7 @@ static int check_cb(GLcontext *ctx, struct radeon_state_atom *atom) return count; } -static int check_blnd(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_blnd(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1485,7 +1485,7 @@ static int check_blnd(GLcontext *ctx, struct radeon_state_atom *atom) return count; } -static int check_ucp(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_ucp(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1500,7 +1500,7 @@ static int check_ucp(GLcontext *ctx, struct radeon_state_atom *atom) return count; } -static int check_vtx(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_vtx(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); int count = context->radeon.tcl.aos_count * 18; @@ -1509,7 +1509,7 @@ static int check_vtx(GLcontext *ctx, struct radeon_state_atom *atom) return count; } -static int check_tx(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_tx(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); unsigned int i, count = 0; @@ -1526,7 +1526,7 @@ static int check_tx(GLcontext *ctx, struct radeon_state_atom *atom) return count * 31; } -static int check_ps_consts(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_ps_consts(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1539,7 +1539,7 @@ static int check_ps_consts(GLcontext *ctx, struct radeon_state_atom *atom) return count; } -static int check_vs_consts(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_vs_consts(struct gl_context *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1552,7 +1552,7 @@ static int check_vs_consts(GLcontext *ctx, struct radeon_state_atom *atom) return count; } -static int check_queryobj(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_queryobj(struct gl_context *ctx, struct radeon_state_atom *atom) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); struct radeon_query_object *query = radeon->query.current; diff --git a/src/mesa/drivers/dri/r600/r700_clear.c b/src/mesa/drivers/dri/r600/r700_clear.c index d1008f28b9..853dec9233 100644 --- a/src/mesa/drivers/dri/r600/r700_clear.c +++ b/src/mesa/drivers/dri/r600/r700_clear.c @@ -45,7 +45,7 @@ static GLboolean r700ClearFast(context_t *context, GLbitfield mask) return GL_FALSE; } -void r700Clear(GLcontext * ctx, GLbitfield mask) +void r700Clear(struct gl_context * ctx, GLbitfield mask) { context_t *context = R700_CONTEXT(ctx); radeonContextPtr radeon = &context->radeon; diff --git a/src/mesa/drivers/dri/r600/r700_clear.h b/src/mesa/drivers/dri/r600/r700_clear.h index bed1d3a90e..de372ee303 100644 --- a/src/mesa/drivers/dri/r600/r700_clear.h +++ b/src/mesa/drivers/dri/r600/r700_clear.h @@ -28,6 +28,6 @@ #ifndef __r700_CLEAR_H__ #define __r700_CLEAR_H__ -extern void r700Clear(GLcontext * ctx, GLbitfield mask); +extern void r700Clear(struct gl_context * ctx, GLbitfield mask); #endif /* __r700_CLEAR_H__ */ diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.c b/src/mesa/drivers/dri/r600/r700_fragprog.c index 217b0e27a4..2a6a39dfba 100644 --- a/src/mesa/drivers/dri/r600/r700_fragprog.c +++ b/src/mesa/drivers/dri/r600/r700_fragprog.c @@ -44,7 +44,7 @@ #include "r700_debug.h" -void insert_wpos_code(GLcontext *ctx, struct gl_fragment_program *fprog) +void insert_wpos_code(struct gl_context *ctx, struct gl_fragment_program *fprog) { static const gl_state_index winstate[STATE_LENGTH] = { STATE_INTERNAL, STATE_FB_SIZE, 0, 0, 0}; @@ -95,7 +95,7 @@ void insert_wpos_code(GLcontext *ctx, struct gl_fragment_program *fprog) //TODO : Validate FP input with VP output. void Map_Fragment_Program(r700_AssemblerBase *pAsm, struct gl_fragment_program *mesa_fp, - GLcontext *ctx) + struct gl_context *ctx) { unsigned int unBit; unsigned int i; @@ -353,7 +353,7 @@ GLboolean Find_Instruction_Dependencies_fp(struct r700_fragment_program *fp, GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp, struct gl_fragment_program *mesa_fp, - GLcontext *ctx) + struct gl_context *ctx) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -466,7 +466,7 @@ GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp, return GL_TRUE; } -void r700SelectFragmentShader(GLcontext *ctx) +void r700SelectFragmentShader(struct gl_context *ctx) { context_t *context = R700_CONTEXT(ctx); struct r700_fragment_program *fp = (struct r700_fragment_program *) @@ -480,7 +480,7 @@ void r700SelectFragmentShader(GLcontext *ctx) r700TranslateFragmentShader(fp, &(fp->mesa_program), ctx); } -void * r700GetActiveFpShaderBo(GLcontext * ctx) +void * r700GetActiveFpShaderBo(struct gl_context * ctx) { struct r700_fragment_program *fp = (struct r700_fragment_program *) (ctx->FragmentProgram._Current); @@ -488,7 +488,7 @@ void * r700GetActiveFpShaderBo(GLcontext * ctx) return fp->shaderbo; } -void * r700GetActiveFpShaderConstBo(GLcontext * ctx) +void * r700GetActiveFpShaderConstBo(struct gl_context * ctx) { struct r700_fragment_program *fp = (struct r700_fragment_program *) (ctx->FragmentProgram._Current); @@ -496,7 +496,7 @@ void * r700GetActiveFpShaderConstBo(GLcontext * ctx) return fp->constbo0; } -GLboolean r700SetupFragmentProgram(GLcontext * ctx) +GLboolean r700SetupFragmentProgram(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.h b/src/mesa/drivers/dri/r600/r700_fragprog.h index aaa6043d5d..bdb95ff0e7 100644 --- a/src/mesa/drivers/dri/r600/r700_fragprog.h +++ b/src/mesa/drivers/dri/r600/r700_fragprog.h @@ -51,25 +51,25 @@ struct r700_fragment_program }; /* Internal */ -void insert_wpos_code(GLcontext *ctx, struct gl_fragment_program *fprog); +void insert_wpos_code(struct gl_context *ctx, struct gl_fragment_program *fprog); void Map_Fragment_Program(r700_AssemblerBase *pAsm, struct gl_fragment_program *mesa_fp, - GLcontext *ctx); + struct gl_context *ctx); GLboolean Find_Instruction_Dependencies_fp(struct r700_fragment_program *fp, struct gl_fragment_program *mesa_fp); GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp, struct gl_fragment_program *mesa_vp, - GLcontext *ctx); + struct gl_context *ctx); /* Interface */ -extern void r700SelectFragmentShader(GLcontext *ctx); +extern void r700SelectFragmentShader(struct gl_context *ctx); -extern GLboolean r700SetupFragmentProgram(GLcontext * ctx); +extern GLboolean r700SetupFragmentProgram(struct gl_context * ctx); -extern void * r700GetActiveFpShaderBo(GLcontext * ctx); +extern void * r700GetActiveFpShaderBo(struct gl_context * ctx); -extern void * r700GetActiveFpShaderConstBo(GLcontext * ctx); +extern void * r700GetActiveFpShaderConstBo(struct gl_context * ctx); #endif /*_R700_FRAGPROG_H_*/ diff --git a/src/mesa/drivers/dri/r600/r700_oglprog.c b/src/mesa/drivers/dri/r600/r700_oglprog.c index e0c9179004..6ca7458003 100644 --- a/src/mesa/drivers/dri/r600/r700_oglprog.c +++ b/src/mesa/drivers/dri/r600/r700_oglprog.c @@ -40,7 +40,7 @@ #include "r700_vertprog.h" -static void freeVertProgCache(GLcontext *ctx, struct r700_vertex_program_cont *cache) +static void freeVertProgCache(struct gl_context *ctx, struct r700_vertex_program_cont *cache) { struct r700_vertex_program *tmp, *vp = cache->progs; @@ -64,7 +64,7 @@ static void freeVertProgCache(GLcontext *ctx, struct r700_vertex_program_cont *c } } -static struct gl_program *r700NewProgram(GLcontext * ctx, +static struct gl_program *r700NewProgram(struct gl_context * ctx, GLenum target, GLuint id) { @@ -109,7 +109,7 @@ static struct gl_program *r700NewProgram(GLcontext * ctx, return pProgram; } -static void r700DeleteProgram(GLcontext * ctx, struct gl_program *prog) +static void r700DeleteProgram(struct gl_context * ctx, struct gl_program *prog) { struct r700_vertex_program_cont *vpc = (struct r700_vertex_program_cont *)prog; struct r700_fragment_program * fp; @@ -147,7 +147,7 @@ static void r700DeleteProgram(GLcontext * ctx, struct gl_program *prog) } static GLboolean -r700ProgramStringNotify(GLcontext * ctx, GLenum target, struct gl_program *prog) +r700ProgramStringNotify(struct gl_context * ctx, GLenum target, struct gl_program *prog) { struct r700_vertex_program_cont *vpc = (struct r700_vertex_program_cont *)prog; struct r700_fragment_program * fp = (struct r700_fragment_program*)prog; @@ -178,7 +178,7 @@ r700ProgramStringNotify(GLcontext * ctx, GLenum target, struct gl_program *prog) return GL_TRUE; } -static GLboolean r700IsProgramNative(GLcontext * ctx, GLenum target, struct gl_program *prog) +static GLboolean r700IsProgramNative(struct gl_context * ctx, GLenum target, struct gl_program *prog) { return GL_TRUE; diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c index f90c69c416..bb14a239b7 100644 --- a/src/mesa/drivers/dri/r600/r700_render.c +++ b/src/mesa/drivers/dri/r600/r700_render.c @@ -244,7 +244,7 @@ static int r700NumVerts(int num_verts, int prim) return num_verts - verts_off; } -static void r700RunRenderPrimitive(GLcontext * ctx, int start, int end, +static void r700RunRenderPrimitive(struct gl_context * ctx, int start, int end, int prim, GLint basevertex) { context_t *context = R700_CONTEXT(ctx); @@ -315,7 +315,7 @@ static void r700RunRenderPrimitive(GLcontext * ctx, int start, int end, COMMIT_BATCH(); } -static void r700RunRenderPrimitiveImmediate(GLcontext * ctx, int start, int end, int prim) +static void r700RunRenderPrimitiveImmediate(struct gl_context * ctx, int start, int end, int prim) { context_t *context = R700_CONTEXT(ctx); BATCH_LOCALS(&context->radeon); @@ -434,7 +434,7 @@ static void r700RunRenderPrimitiveImmediate(GLcontext * ctx, int start, int end, /* start 3d, idle, cb/db flush */ #define PRE_EMIT_STATE_BUFSZ 5 + 5 + 14 -static GLuint r700PredictRenderSize(GLcontext* ctx, +static GLuint r700PredictRenderSize(struct gl_context* ctx, const struct _mesa_prim *prim, const struct _mesa_index_buffer *ib, GLuint nr_prims) @@ -501,7 +501,7 @@ static GLuint r700PredictRenderSize(GLcontext* ctx, * Convert attribute data type to float * If the attribute uses named buffer object replace the bo with newly allocated bo */ -static void r700ConvertAttrib(GLcontext *ctx, int count, +static void r700ConvertAttrib(struct gl_context *ctx, int count, const struct gl_client_array *input, struct StreamDesc *attr) { @@ -580,7 +580,7 @@ static void r700ConvertAttrib(GLcontext *ctx, int count, } } -static void r700AlignDataToDword(GLcontext *ctx, +static void r700AlignDataToDword(struct gl_context *ctx, const struct gl_client_array *input, int count, struct StreamDesc *attr) @@ -622,7 +622,7 @@ static void r700AlignDataToDword(GLcontext *ctx, attr->stride = dst_stride; } -static void r700SetupStreams(GLcontext *ctx, const struct gl_client_array *input[], int count) +static void r700SetupStreams(struct gl_context *ctx, const struct gl_client_array *input[], int count) { context_t *context = R700_CONTEXT(ctx); GLuint stride; @@ -723,7 +723,7 @@ static void r700SetupStreams(GLcontext *ctx, const struct gl_client_array *input RADEON_GEM_DOMAIN_GTT, 0); } -static void r700FreeData(GLcontext *ctx) +static void r700FreeData(struct gl_context *ctx) { /* Need to zero tcl.aos[n].bo and tcl.elt_dma_bo * to prevent double unref in radeonReleaseArrays @@ -748,7 +748,7 @@ static void r700FreeData(GLcontext *ctx) } } -static void r700FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer *mesa_ind_buf) +static void r700FixupIndexBuffer(struct gl_context *ctx, const struct _mesa_index_buffer *mesa_ind_buf) { context_t *context = R700_CONTEXT(ctx); GLvoid *src_ptr; @@ -823,7 +823,7 @@ static void r700FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer } } -static void r700SetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer *mesa_ind_buf) +static void r700SetupIndexBuffer(struct gl_context *ctx, const struct _mesa_index_buffer *mesa_ind_buf) { context_t *context = R700_CONTEXT(ctx); @@ -876,7 +876,7 @@ static void r700SetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer } } -static GLboolean check_fallbacks(GLcontext *ctx) +static GLboolean check_fallbacks(struct gl_context *ctx) { if (ctx->RenderMode != GL_RENDER) return GL_TRUE; @@ -884,7 +884,7 @@ static GLboolean check_fallbacks(GLcontext *ctx) return GL_FALSE; } -static GLboolean r700TryDrawPrims(GLcontext *ctx, +static GLboolean r700TryDrawPrims(struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, @@ -972,7 +972,7 @@ static GLboolean r700TryDrawPrims(GLcontext *ctx, return GL_TRUE; } -static void r700DrawPrims(GLcontext *ctx, +static void r700DrawPrims(struct gl_context *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, @@ -1011,7 +1011,7 @@ static void r700DrawPrims(GLcontext *ctx, } } -void r700InitDraw(GLcontext *ctx) +void r700InitDraw(struct gl_context *ctx) { struct vbo_context *vbo = vbo_context(ctx); diff --git a/src/mesa/drivers/dri/r600/r700_shader.c b/src/mesa/drivers/dri/r600/r700_shader.c index 8b3ed5cd82..cbbfaed31c 100644 --- a/src/mesa/drivers/dri/r600/r700_shader.c +++ b/src/mesa/drivers/dri/r600/r700_shader.c @@ -38,7 +38,7 @@ #include "r700_shader.h" -void r700ShaderInit(GLcontext * ctx) +void r700ShaderInit(struct gl_context * ctx) { } diff --git a/src/mesa/drivers/dri/r600/r700_shader.h b/src/mesa/drivers/dri/r600/r700_shader.h index 0599ffd901..183dd33525 100644 --- a/src/mesa/drivers/dri/r600/r700_shader.h +++ b/src/mesa/drivers/dri/r600/r700_shader.h @@ -33,7 +33,7 @@ #include "r700_shaderinst.h" -void r700ShaderInit(GLcontext * ctx); +void r700ShaderInit(struct gl_context * ctx); typedef enum R700ShaderType { diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c index 925b4ffe6d..bd04a633b4 100644 --- a/src/mesa/drivers/dri/r600/r700_state.c +++ b/src/mesa/drivers/dri/r600/r700_state.c @@ -52,14 +52,14 @@ #include "r700_fragprog.h" #include "r700_vertprog.h" -void r600UpdateTextureState(GLcontext * ctx); -static void r700SetClipPlaneState(GLcontext * ctx, GLenum cap, GLboolean state); -static void r700UpdatePolygonMode(GLcontext * ctx); -static void r700SetPolygonOffsetState(GLcontext * ctx, GLboolean state); -static void r700SetStencilState(GLcontext * ctx, GLboolean state); -static void r700UpdateWindow(GLcontext * ctx, int id); - -void r700UpdateShaders(GLcontext * ctx) +void r600UpdateTextureState(struct gl_context * ctx); +static void r700SetClipPlaneState(struct gl_context * ctx, GLenum cap, GLboolean state); +static void r700UpdatePolygonMode(struct gl_context * ctx); +static void r700SetPolygonOffsetState(struct gl_context * ctx, GLboolean state); +static void r700SetStencilState(struct gl_context * ctx, GLboolean state); +static void r700UpdateWindow(struct gl_context * ctx, int id); + +void r700UpdateShaders(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); @@ -80,7 +80,7 @@ void r700UpdateShaders(GLcontext * ctx) /* * To correctly position primitives: */ -void r700UpdateViewportOffset(GLcontext * ctx) //------------------ +void r700UpdateViewportOffset(struct gl_context * ctx) //------------------ { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -106,7 +106,7 @@ void r700UpdateViewportOffset(GLcontext * ctx) //------------------ radeonUpdateScissor(ctx); } -void r700UpdateStateParameters(GLcontext * ctx, GLuint new_state) //-------------------- +void r700UpdateStateParameters(struct gl_context * ctx, GLuint new_state) //-------------------- { struct r700_fragment_program *fp = (struct r700_fragment_program *)ctx->FragmentProgram._Current; @@ -130,7 +130,7 @@ void r700UpdateStateParameters(GLcontext * ctx, GLuint new_state) //------------ /** * Called by Mesa after an internal state update. */ -static void r700InvalidateState(GLcontext * ctx, GLuint new_state) //------------------- +static void r700InvalidateState(struct gl_context * ctx, GLuint new_state) //------------------- { context_t *context = R700_CONTEXT(ctx); @@ -190,7 +190,7 @@ static void r700InvalidateState(GLcontext * ctx, GLuint new_state) //----------- context->radeon.NewGLState |= new_state; } -static void r700SetDBRenderState(GLcontext * ctx) +static void r700SetDBRenderState(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -245,13 +245,13 @@ static void r700SetDBRenderState(GLcontext * ctx) } } -void r700UpdateShaderStates(GLcontext * ctx) +void r700UpdateShaderStates(struct gl_context * ctx) { r700SetDBRenderState(ctx); r600UpdateTextureState(ctx); } -static void r700SetDepthState(GLcontext * ctx) +static void r700SetDepthState(struct gl_context * ctx) { struct radeon_renderbuffer *rrb; context_t *context = R700_CONTEXT(ctx); @@ -320,7 +320,7 @@ static void r700SetDepthState(GLcontext * ctx) } } -static void r700SetAlphaState(GLcontext * ctx) +static void r700SetAlphaState(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -368,7 +368,7 @@ static void r700SetAlphaState(GLcontext * ctx) } -static void r700AlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref) //--------------- +static void r700AlphaFunc(struct gl_context * ctx, GLenum func, GLfloat ref) //--------------- { (void)func; (void)ref; @@ -376,7 +376,7 @@ static void r700AlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref) //--------- } -static void r700BlendColor(GLcontext * ctx, const GLfloat cf[4]) //---------------- +static void r700BlendColor(struct gl_context * ctx, const GLfloat cf[4]) //---------------- { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -444,7 +444,7 @@ static int blend_factor(GLenum factor, GLboolean is_src) } } -static void r700SetBlendState(GLcontext * ctx) +static void r700SetBlendState(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -576,13 +576,13 @@ static void r700SetBlendState(GLcontext * ctx) } -static void r700BlendEquationSeparate(GLcontext * ctx, +static void r700BlendEquationSeparate(struct gl_context * ctx, GLenum modeRGB, GLenum modeA) //----------------- { r700SetBlendState(ctx); } -static void r700BlendFuncSeparate(GLcontext * ctx, +static void r700BlendFuncSeparate(struct gl_context * ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA) //------------------------ { @@ -637,7 +637,7 @@ static GLuint translate_logicop(GLenum logicop) * Used internally to update the r300->hw hardware state to match the * current OpenGL state. */ -static void r700SetLogicOpState(GLcontext *ctx) +static void r700SetLogicOpState(struct gl_context *ctx) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&R700_CONTEXT(ctx)->hw); @@ -655,13 +655,13 @@ static void r700SetLogicOpState(GLcontext *ctx) * Called by Mesa when an application program changes the LogicOp state * via glLogicOp. */ -static void r700LogicOpcode(GLcontext *ctx, GLenum logicop) +static void r700LogicOpcode(struct gl_context *ctx, GLenum logicop) { if (RGBA_LOGICOP_ENABLED(ctx)) r700SetLogicOpState(ctx); } -static void r700UpdateCulling(GLcontext * ctx) +static void r700UpdateCulling(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&R700_CONTEXT(ctx)->hw); @@ -713,7 +713,7 @@ static void r700UpdateCulling(GLcontext * ctx) r700->PA_SU_SC_MODE_CNTL.u32All ^= FACE_bit; } -static void r700UpdateLineStipple(GLcontext * ctx) +static void r700UpdateLineStipple(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&R700_CONTEXT(ctx)->hw); @@ -730,7 +730,7 @@ static void r700UpdateLineStipple(GLcontext * ctx) } } -static void r700Enable(GLcontext * ctx, GLenum cap, GLboolean state) //------------------ +static void r700Enable(struct gl_context * ctx, GLenum cap, GLboolean state) //------------------ { context_t *context = R700_CONTEXT(ctx); @@ -794,7 +794,7 @@ static void r700Enable(GLcontext * ctx, GLenum cap, GLboolean state) //--------- /** * Handle glColorMask() */ -static void r700ColorMask(GLcontext * ctx, +static void r700ColorMask(struct gl_context * ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a) //------------------ { context_t *context = R700_CONTEXT(ctx); @@ -815,7 +815,7 @@ static void r700ColorMask(GLcontext * ctx, * * \note Mesa already filters redundant calls to this function. */ -static void r700DepthFunc(GLcontext * ctx, GLenum func) //-------------------- +static void r700DepthFunc(struct gl_context * ctx, GLenum func) //-------------------- { r700SetDepthState(ctx); } @@ -825,7 +825,7 @@ static void r700DepthFunc(GLcontext * ctx, GLenum func) //-------------------- * * \note Mesa already filters redundant calls to this function. */ -static void r700DepthMask(GLcontext * ctx, GLboolean mask) //------------------ +static void r700DepthMask(struct gl_context * ctx, GLboolean mask) //------------------ { r700SetDepthState(ctx); } @@ -835,7 +835,7 @@ static void r700DepthMask(GLcontext * ctx, GLboolean mask) //------------------ * * \note Mesa already filters redundant calls to this function. */ -static void r700CullFace(GLcontext * ctx, GLenum mode) //----------------- +static void r700CullFace(struct gl_context * ctx, GLenum mode) //----------------- { r700UpdateCulling(ctx); } @@ -843,7 +843,7 @@ static void r700CullFace(GLcontext * ctx, GLenum mode) //----------------- /* ============================================================= * Fog */ -static void r700Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param) //-------------- +static void r700Fogfv(struct gl_context * ctx, GLenum pname, const GLfloat * param) //-------------- { } @@ -852,13 +852,13 @@ static void r700Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param) //-- * * \note Mesa already filters redundant calls to this function. */ -static void r700FrontFace(GLcontext * ctx, GLenum mode) //------------------ +static void r700FrontFace(struct gl_context * ctx, GLenum mode) //------------------ { r700UpdateCulling(ctx); r700UpdatePolygonMode(ctx); } -static void r700ShadeModel(GLcontext * ctx, GLenum mode) //-------------------- +static void r700ShadeModel(struct gl_context * ctx, GLenum mode) //-------------------- { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -881,7 +881,7 @@ static void r700ShadeModel(GLcontext * ctx, GLenum mode) //-------------------- /* ============================================================= * Point state */ -static void r700PointSize(GLcontext * ctx, GLfloat size) +static void r700PointSize(struct gl_context * ctx, GLfloat size) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -903,7 +903,7 @@ static void r700PointSize(GLcontext * ctx, GLfloat size) } -static void r700PointParameter(GLcontext * ctx, GLenum pname, const GLfloat * param) //--------------- +static void r700PointParameter(struct gl_context * ctx, GLenum pname, const GLfloat * param) //--------------- { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -980,7 +980,7 @@ static int translate_stencil_op(int op) return 0; } -static void r700SetStencilState(GLcontext * ctx, GLboolean state) +static void r700SetStencilState(struct gl_context * ctx, GLboolean state) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1002,7 +1002,7 @@ static void r700SetStencilState(GLcontext * ctx, GLboolean state) } } -static void r700StencilFuncSeparate(GLcontext * ctx, GLenum face, +static void r700StencilFuncSeparate(struct gl_context * ctx, GLenum face, GLenum func, GLint ref, GLuint mask) //--------------------- { context_t *context = R700_CONTEXT(ctx); @@ -1032,7 +1032,7 @@ static void r700StencilFuncSeparate(GLcontext * ctx, GLenum face, } -static void r700StencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask) //-------------- +static void r700StencilMaskSeparate(struct gl_context * ctx, GLenum face, GLuint mask) //-------------- { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1050,7 +1050,7 @@ static void r700StencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask) / } -static void r700StencilOpSeparate(GLcontext * ctx, GLenum face, +static void r700StencilOpSeparate(struct gl_context * ctx, GLenum face, GLenum fail, GLenum zfail, GLenum zpass) //-------------------- { context_t *context = R700_CONTEXT(ctx); @@ -1074,7 +1074,7 @@ static void r700StencilOpSeparate(GLcontext * ctx, GLenum face, STENCILZPASS_BF_shift, STENCILZPASS_BF_mask); } -static void r700UpdateWindow(GLcontext * ctx, int id) //-------------------- +static void r700UpdateWindow(struct gl_context * ctx, int id) //-------------------- { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1131,7 +1131,7 @@ static void r700UpdateWindow(GLcontext * ctx, int id) //-------------------- } -static void r700Viewport(GLcontext * ctx, +static void r700Viewport(struct gl_context * ctx, GLint x, GLint y, GLsizei width, @@ -1142,12 +1142,12 @@ static void r700Viewport(GLcontext * ctx, radeon_viewport(ctx, x, y, width, height); } -static void r700DepthRange(GLcontext * ctx, GLclampd nearval, GLclampd farval) //------------- +static void r700DepthRange(struct gl_context * ctx, GLclampd nearval, GLclampd farval) //------------- { r700UpdateWindow(ctx, 0); } -static void r700LineWidth(GLcontext * ctx, GLfloat widthf) //--------------- +static void r700LineWidth(struct gl_context * ctx, GLfloat widthf) //--------------- { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1161,7 +1161,7 @@ static void r700LineWidth(GLcontext * ctx, GLfloat widthf) //--------------- PA_SU_LINE_CNTL__WIDTH_shift, PA_SU_LINE_CNTL__WIDTH_mask); } -static void r700LineStipple(GLcontext *ctx, GLint factor, GLushort pattern) +static void r700LineStipple(struct gl_context *ctx, GLint factor, GLushort pattern) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1173,7 +1173,7 @@ static void r700LineStipple(GLcontext *ctx, GLint factor, GLushort pattern) SETfield(r700->PA_SC_LINE_STIPPLE.u32All, 1, AUTO_RESET_CNTL_shift, AUTO_RESET_CNTL_mask); } -static void r700SetPolygonOffsetState(GLcontext * ctx, GLboolean state) +static void r700SetPolygonOffsetState(struct gl_context * ctx, GLboolean state) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1191,7 +1191,7 @@ static void r700SetPolygonOffsetState(GLcontext * ctx, GLboolean state) } } -static void r700PolygonOffset(GLcontext * ctx, GLfloat factor, GLfloat units) //-------------- +static void r700PolygonOffset(struct gl_context * ctx, GLfloat factor, GLfloat units) //-------------- { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1221,7 +1221,7 @@ static void r700PolygonOffset(GLcontext * ctx, GLfloat factor, GLfloat units) // r700->PA_SU_POLY_OFFSET_BACK_OFFSET.f32All = constant; } -static void r700UpdatePolygonMode(GLcontext * ctx) +static void r700UpdatePolygonMode(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1276,7 +1276,7 @@ static void r700UpdatePolygonMode(GLcontext * ctx) } } -static void r700PolygonMode(GLcontext * ctx, GLenum face, GLenum mode) //------------------ +static void r700PolygonMode(struct gl_context * ctx, GLenum face, GLenum mode) //------------------ { (void)face; (void)mode; @@ -1284,11 +1284,11 @@ static void r700PolygonMode(GLcontext * ctx, GLenum face, GLenum mode) //------- r700UpdatePolygonMode(ctx); } -static void r700RenderMode(GLcontext * ctx, GLenum mode) //--------------------- +static void r700RenderMode(struct gl_context * ctx, GLenum mode) //--------------------- { } -static void r700ClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq ) +static void r700ClipPlane( struct gl_context *ctx, GLenum plane, const GLfloat *eq ) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1306,7 +1306,7 @@ static void r700ClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq ) r700->ucp[p].PA_CL_UCP_0_W.u32All = ip[3]; } -static void r700SetClipPlaneState(GLcontext * ctx, GLenum cap, GLboolean state) +static void r700SetClipPlaneState(struct gl_context * ctx, GLenum cap, GLboolean state) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1428,7 +1428,7 @@ void r700SetScissor(context_t *context) //--------------- r700->viewport[id].enabled = GL_TRUE; } -static void r700InitSQConfig(GLcontext * ctx) +static void r700InitSQConfig(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); @@ -1635,7 +1635,7 @@ static void r700InitSQConfig(GLcontext * ctx) * Assumes that the command buffer and state atoms have been * initialized already. */ -void r700InitState(GLcontext * ctx) //------------------- +void r700InitState(struct gl_context * ctx) //------------------- { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); diff --git a/src/mesa/drivers/dri/r600/r700_state.h b/src/mesa/drivers/dri/r600/r700_state.h index 56885e0b15..2d51198c8a 100644 --- a/src/mesa/drivers/dri/r600/r700_state.h +++ b/src/mesa/drivers/dri/r600/r700_state.h @@ -33,13 +33,13 @@ #include "r700_chip.h" -extern void r700UpdateStateParameters(GLcontext * ctx, GLuint new_state); -extern void r700UpdateShaders (GLcontext * ctx); -extern void r700UpdateShaderStates(GLcontext * ctx); +extern void r700UpdateStateParameters(struct gl_context * ctx, GLuint new_state); +extern void r700UpdateShaders (struct gl_context * ctx); +extern void r700UpdateShaderStates(struct gl_context * ctx); -extern void r700UpdateViewportOffset(GLcontext * ctx); +extern void r700UpdateViewportOffset(struct gl_context * ctx); -extern void r700InitState (GLcontext * ctx); +extern void r700InitState (struct gl_context * ctx); extern void r700InitStateFuncs (radeonContextPtr radeon, struct dd_function_table *functions); extern void r700SetScissor(context_t *context); diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.c b/src/mesa/drivers/dri/r600/r700_vertprog.c index 2fee5b4433..7ba49d8f98 100644 --- a/src/mesa/drivers/dri/r600/r700_vertprog.c +++ b/src/mesa/drivers/dri/r600/r700_vertprog.c @@ -170,7 +170,7 @@ GLboolean Process_Vertex_Program_Vfetch_Instructions( } GLboolean Process_Vertex_Program_Vfetch_Instructions2( - GLcontext *ctx, + struct gl_context *ctx, struct r700_vertex_program *vp, struct gl_vertex_program *mesa_vp) { @@ -197,7 +197,7 @@ GLboolean Process_Vertex_Program_Vfetch_Instructions2( return GL_TRUE; } -void Map_Vertex_Program(GLcontext *ctx, +void Map_Vertex_Program(struct gl_context *ctx, struct r700_vertex_program *vp, struct gl_vertex_program *mesa_vp) { @@ -293,7 +293,7 @@ GLboolean Find_Instruction_Dependencies_vp(struct r700_vertex_program *vp, return GL_TRUE; } -struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, +struct r700_vertex_program* r700TranslateVertexShader(struct gl_context *ctx, struct gl_vertex_program *mesa_vp) { context_t *context = R700_CONTEXT(ctx); @@ -385,7 +385,7 @@ struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, return vp; } -void r700SelectVertexShader(GLcontext *ctx) +void r700SelectVertexShader(struct gl_context *ctx) { context_t *context = R700_CONTEXT(ctx); struct r700_vertex_program_cont *vpc; @@ -459,7 +459,7 @@ int getTypeSize(GLenum type) } } -static void r700TranslateAttrib(GLcontext *ctx, GLuint unLoc, int count, const struct gl_client_array *input) +static void r700TranslateAttrib(struct gl_context *ctx, GLuint unLoc, int count, const struct gl_client_array *input) { context_t *context = R700_CONTEXT(ctx); @@ -545,7 +545,7 @@ static void r700TranslateAttrib(GLcontext *ctx, GLuint unLoc, int count, const s context->nNumActiveAos++; } -void r700SetVertexFormat(GLcontext *ctx, const struct gl_client_array *arrays[], int count) +void r700SetVertexFormat(struct gl_context *ctx, const struct gl_client_array *arrays[], int count) { context_t *context = R700_CONTEXT(ctx); struct r700_vertex_program *vpc @@ -574,7 +574,7 @@ void r700SetVertexFormat(GLcontext *ctx, const struct gl_client_array *arrays[], context->radeon.tcl.aos_count = context->nNumActiveAos; } -void * r700GetActiveVpShaderBo(GLcontext * ctx) +void * r700GetActiveVpShaderBo(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); struct r700_vertex_program *vp = context->selected_vp;; @@ -585,7 +585,7 @@ void * r700GetActiveVpShaderBo(GLcontext * ctx) return NULL; } -void * r700GetActiveVpShaderConstBo(GLcontext * ctx) +void * r700GetActiveVpShaderConstBo(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); struct r700_vertex_program *vp = context->selected_vp;; @@ -596,7 +596,7 @@ void * r700GetActiveVpShaderConstBo(GLcontext * ctx) return NULL; } -GLboolean r700SetupVertexProgram(GLcontext * ctx) +GLboolean r700SetupVertexProgram(struct gl_context * ctx) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.h b/src/mesa/drivers/dri/r600/r700_vertprog.h index 9acdc8e350..859afb6e97 100644 --- a/src/mesa/drivers/dri/r600/r700_vertprog.h +++ b/src/mesa/drivers/dri/r600/r700_vertprog.h @@ -80,27 +80,27 @@ GLboolean Process_Vertex_Program_Vfetch_Instructions( struct r700_vertex_program *vp, struct gl_vertex_program *mesa_vp); GLboolean Process_Vertex_Program_Vfetch_Instructions2( - GLcontext *ctx, + struct gl_context *ctx, struct r700_vertex_program *vp, struct gl_vertex_program *mesa_vp); -void Map_Vertex_Program(GLcontext *ctx, +void Map_Vertex_Program(struct gl_context *ctx, struct r700_vertex_program *vp, struct gl_vertex_program *mesa_vp); GLboolean Find_Instruction_Dependencies_vp(struct r700_vertex_program *vp, struct gl_vertex_program *mesa_vp); -struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, +struct r700_vertex_program* r700TranslateVertexShader(struct gl_context *ctx, struct gl_vertex_program *mesa_vp); /* Interface */ -extern void r700SelectVertexShader(GLcontext *ctx); -extern void r700SetVertexFormat(GLcontext *ctx, const struct gl_client_array *arrays[], int count); +extern void r700SelectVertexShader(struct gl_context *ctx); +extern void r700SetVertexFormat(struct gl_context *ctx, const struct gl_client_array *arrays[], int count); -extern GLboolean r700SetupVertexProgram(GLcontext * ctx); +extern GLboolean r700SetupVertexProgram(struct gl_context * ctx); -extern void * r700GetActiveVpShaderBo(GLcontext * ctx); +extern void * r700GetActiveVpShaderBo(struct gl_context * ctx); -extern void * r700GetActiveVpShaderConstBo(GLcontext * ctx); +extern void * r700GetActiveVpShaderConstBo(struct gl_context * ctx); extern int getTypeSize(GLenum type); diff --git a/src/mesa/drivers/dri/radeon/radeon_blit.c b/src/mesa/drivers/dri/radeon/radeon_blit.c index 143822361e..fe14540bc2 100644 --- a/src/mesa/drivers/dri/radeon/radeon_blit.c +++ b/src/mesa/drivers/dri/radeon/radeon_blit.c @@ -321,7 +321,7 @@ static inline void emit_draw_packet(struct r100_context *r100, * @param[in] height region height * @param[in] flip_y set if y coords of the source image need to be flipped */ -unsigned r100_blit(GLcontext *ctx, +unsigned r100_blit(struct gl_context *ctx, struct radeon_bo *src_bo, intptr_t src_offset, gl_format src_mesaformat, diff --git a/src/mesa/drivers/dri/radeon/radeon_blit.h b/src/mesa/drivers/dri/radeon/radeon_blit.h index d7d0b5554a..5e5c73481a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_blit.h +++ b/src/mesa/drivers/dri/radeon/radeon_blit.h @@ -32,7 +32,7 @@ void r100_blit_init(struct r100_context *r100); unsigned r100_check_blit(gl_format mesa_format); -unsigned r100_blit(GLcontext *ctx, +unsigned r100_blit(struct gl_context *ctx, struct radeon_bo *src_bo, intptr_t src_offset, gl_format src_mesaformat, diff --git a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c index 0897dafbd8..0d1af726c0 100644 --- a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c +++ b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c @@ -40,7 +40,7 @@ get_radeon_buffer_object(struct gl_buffer_object *obj) } static struct gl_buffer_object * -radeonNewBufferObject(GLcontext * ctx, +radeonNewBufferObject(struct gl_context * ctx, GLuint name, GLenum target) { @@ -57,7 +57,7 @@ radeonNewBufferObject(GLcontext * ctx, * Called via glDeleteBuffersARB(). */ static void -radeonDeleteBufferObject(GLcontext * ctx, +radeonDeleteBufferObject(struct gl_context * ctx, struct gl_buffer_object *obj) { struct radeon_buffer_object *radeon_obj = get_radeon_buffer_object(obj); @@ -82,7 +82,7 @@ radeonDeleteBufferObject(GLcontext * ctx, * \return GL_TRUE for success, GL_FALSE if out of memory */ static GLboolean -radeonBufferData(GLcontext * ctx, +radeonBufferData(struct gl_context * ctx, GLenum target, GLsizeiptrARB size, const GLvoid * data, @@ -129,7 +129,7 @@ radeonBufferData(GLcontext * ctx, * Called via glBufferSubDataARB(). */ static void -radeonBufferSubData(GLcontext * ctx, +radeonBufferSubData(struct gl_context * ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, @@ -154,7 +154,7 @@ radeonBufferSubData(GLcontext * ctx, * Called via glGetBufferSubDataARB() */ static void -radeonGetBufferSubData(GLcontext * ctx, +radeonGetBufferSubData(struct gl_context * ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, @@ -174,7 +174,7 @@ radeonGetBufferSubData(GLcontext * ctx, * Called via glMapBufferARB() */ static void * -radeonMapBuffer(GLcontext * ctx, +radeonMapBuffer(struct gl_context * ctx, GLenum target, GLenum access, struct gl_buffer_object *obj) @@ -204,7 +204,7 @@ radeonMapBuffer(GLcontext * ctx, * Called via glUnmapBufferARB() */ static GLboolean -radeonUnmapBuffer(GLcontext * ctx, +radeonUnmapBuffer(struct gl_context * ctx, GLenum target, struct gl_buffer_object *obj) { diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index c1a660af3d..43a6355ad8 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -201,7 +201,7 @@ void radeonSetCliprects(radeonContextPtr radeon) -void radeonUpdateScissor( GLcontext *ctx ) +void radeonUpdateScissor( struct gl_context *ctx ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); GLint x = ctx->Scissor.X, y = ctx->Scissor.Y; @@ -252,7 +252,7 @@ void radeonUpdateScissor( GLcontext *ctx ) * Scissoring */ -void radeonScissor(GLcontext* ctx, GLint x, GLint y, GLsizei w, GLsizei h) +void radeonScissor(struct gl_context* ctx, GLint x, GLint y, GLsizei w, GLsizei h) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); if (ctx->Scissor.Enabled) { @@ -578,7 +578,7 @@ void radeonSwapBuffers(__DRIdrawable * dPriv) if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) { radeonContextPtr radeon; - GLcontext *ctx; + struct gl_context *ctx; radeon = (radeonContextPtr) dPriv->driContextPriv->driverPrivate; ctx = radeon->glCtx; @@ -620,7 +620,7 @@ void radeonCopySubBuffer(__DRIdrawable * dPriv, { if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) { radeonContextPtr radeon; - GLcontext *ctx; + struct gl_context *ctx; radeon = (radeonContextPtr) dPriv->driContextPriv->driverPrivate; ctx = radeon->glCtx; @@ -646,7 +646,7 @@ void radeonCopySubBuffer(__DRIdrawable * dPriv, * If so, set the intel->front_buffer_dirty field to true. */ void -radeon_check_front_buffer_rendering(GLcontext *ctx) +radeon_check_front_buffer_rendering(struct gl_context *ctx) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); const struct gl_framebuffer *fb = ctx->DrawBuffer; @@ -662,7 +662,7 @@ radeon_check_front_buffer_rendering(GLcontext *ctx) } -void radeon_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb) +void radeon_draw_buffer(struct gl_context *ctx, struct gl_framebuffer *fb) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); struct radeon_renderbuffer *rrbDepth = NULL, *rrbStencil = NULL, @@ -817,7 +817,7 @@ void radeon_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb) /** * Called via glDrawBuffer. */ -void radeonDrawBuffer( GLcontext *ctx, GLenum mode ) +void radeonDrawBuffer( struct gl_context *ctx, GLenum mode ) { if (RADEON_DEBUG & RADEON_DRI) fprintf(stderr, "%s %s\n", __FUNCTION__, @@ -844,7 +844,7 @@ void radeonDrawBuffer( GLcontext *ctx, GLenum mode ) radeon_draw_buffer(ctx, ctx->DrawBuffer); } -void radeonReadBuffer( GLcontext *ctx, GLenum mode ) +void radeonReadBuffer( struct gl_context *ctx, GLenum mode ) { if ((ctx->DrawBuffer != NULL) && (ctx->DrawBuffer->Name == 0)) { struct radeon_context *const rmesa = RADEON_CONTEXT(ctx); @@ -891,11 +891,11 @@ void radeon_window_moved(radeonContextPtr radeon) } } -void radeon_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height) +void radeon_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); __DRIcontext *driContext = radeon->dri.context; - void (*old_viewport)(GLcontext *ctx, GLint x, GLint y, + void (*old_viewport)(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h); if (!driContext->driScreenPriv->dri2.enabled) @@ -1064,7 +1064,7 @@ static INLINE void radeonEmitAtoms(radeonContextPtr radeon, GLboolean emitAll) COMMIT_BATCH(); } -static GLboolean radeon_revalidate_bos(GLcontext *ctx) +static GLboolean radeon_revalidate_bos(struct gl_context *ctx) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); int ret; @@ -1104,7 +1104,7 @@ void radeonEmitState(radeonContextPtr radeon) } -void radeonFlush(GLcontext *ctx) +void radeonFlush(struct gl_context *ctx) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); if (RADEON_DEBUG & RADEON_IOCTL) @@ -1145,7 +1145,7 @@ flush_front: /* Make sure all commands have been sent to the hardware and have * completed processing. */ -void radeonFinish(GLcontext * ctx) +void radeonFinish(struct gl_context * ctx) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); struct gl_framebuffer *fb = ctx->DrawBuffer; @@ -1327,7 +1327,7 @@ void rcommonBeginBatch(radeonContextPtr rmesa, int n, } -void radeonUserClear(GLcontext *ctx, GLuint mask) +void radeonUserClear(struct gl_context *ctx, GLuint mask) { _mesa_meta_Clear(ctx, mask); } diff --git a/src/mesa/drivers/dri/radeon/radeon_common.h b/src/mesa/drivers/dri/radeon/radeon_common.h index 35b3f08fff..85a114623a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.h +++ b/src/mesa/drivers/dri/radeon/radeon_common.h @@ -5,11 +5,11 @@ #include "radeon_dma.h" #include "radeon_texture.h" -void radeonUserClear(GLcontext *ctx, GLuint mask); +void radeonUserClear(struct gl_context *ctx, GLuint mask); void radeonRecalcScissorRects(radeonContextPtr radeon); void radeonSetCliprects(radeonContextPtr radeon); -void radeonUpdateScissor( GLcontext *ctx ); -void radeonScissor(GLcontext* ctx, GLint x, GLint y, GLsizei w, GLsizei h); +void radeonUpdateScissor( struct gl_context *ctx ); +void radeonScissor(struct gl_context* ctx, GLint x, GLint y, GLsizei w, GLsizei h); void radeonWaitForIdleLocked(radeonContextPtr radeon); extern uint32_t radeonGetAge(radeonContextPtr radeon); @@ -21,18 +21,18 @@ void radeonCopySubBuffer(__DRIdrawable * dPriv, void radeonUpdatePageFlipping(radeonContextPtr rmesa); -void radeonFlush(GLcontext *ctx); -void radeonFinish(GLcontext * ctx); +void radeonFlush(struct gl_context *ctx); +void radeonFinish(struct gl_context * ctx); void radeonEmitState(radeonContextPtr radeon); GLuint radeonCountStateEmitSize(radeonContextPtr radeon); -void radeon_clear_tris(GLcontext *ctx, GLbitfield mask); +void radeon_clear_tris(struct gl_context *ctx, GLbitfield mask); void radeon_window_moved(radeonContextPtr radeon); -void radeon_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb); -void radeonDrawBuffer( GLcontext *ctx, GLenum mode ); -void radeonReadBuffer( GLcontext *ctx, GLenum mode ); -void radeon_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height); +void radeon_draw_buffer(struct gl_context *ctx, struct gl_framebuffer *fb); +void radeonDrawBuffer( struct gl_context *ctx, GLenum mode ); +void radeonReadBuffer( struct gl_context *ctx, GLenum mode ); +void radeon_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height); void radeon_get_cliprects(radeonContextPtr radeon, struct drm_clip_rect **cliprects, unsigned int *num_cliprects, @@ -45,12 +45,12 @@ struct radeon_renderbuffer * radeon_create_renderbuffer(gl_format format, __DRIdrawable *driDrawPriv); void -radeonReadPixels(GLcontext * ctx, +radeonReadPixels(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *pack, GLvoid * pixels); -void radeon_check_front_buffer_rendering(GLcontext *ctx); +void radeon_check_front_buffer_rendering(struct gl_context *ctx); static inline struct radeon_renderbuffer *radeon_renderbuffer(struct gl_renderbuffer *rb) { struct radeon_renderbuffer *rrb = (struct radeon_renderbuffer *)rb; diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c index b0340cee21..40544860b3 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c @@ -105,7 +105,7 @@ static const char* get_chip_family_name(int chip_family) /* Return various strings for glGetString(). */ -static const GLubyte *radeonGetString(GLcontext * ctx, GLenum name) +static const GLubyte *radeonGetString(struct gl_context * ctx, GLenum name) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); static char buffer[128]; @@ -180,14 +180,14 @@ static void radeonInitDriverFuncs(struct dd_function_table *functions) */ GLboolean radeonInitContext(radeonContextPtr radeon, struct dd_function_table* functions, - const __GLcontextModes * glVisual, + const struct gl_config * glVisual, __DRIcontext * driContextPriv, void *sharedContextPrivate) { __DRIscreen *sPriv = driContextPriv->driScreenPriv; radeonScreenPtr screen = (radeonScreenPtr) (sPriv->private); - GLcontext* ctx; - GLcontext* shareCtx; + struct gl_context* ctx; + struct gl_context* shareCtx; int fthrottle_mode; /* Fill in additional standard functions. */ @@ -245,9 +245,16 @@ GLboolean radeonInitContext(radeonContextPtr radeon, DRI_CONF_TEXTURE_DEPTH_32 : DRI_CONF_TEXTURE_DEPTH_16; if (IS_R600_CLASS(radeon->radeonScreen)) { - radeon->texture_row_align = 256; - radeon->texture_rect_row_align = 256; - radeon->texture_compressed_row_align = 256; + int chip_family = radeon->radeonScreen->chip_family; + if (chip_family >= CHIP_FAMILY_CEDAR) { + radeon->texture_row_align = 512; + radeon->texture_rect_row_align = 512; + radeon->texture_compressed_row_align = 512; + } else { + radeon->texture_row_align = 256; + radeon->texture_rect_row_align = 256; + radeon->texture_compressed_row_align = 256; + } } else if (IS_R200_CLASS(radeon->radeonScreen) || IS_R100_CLASS(radeon->radeonScreen)) { radeon->texture_row_align = 32; @@ -514,6 +521,7 @@ void radeon_prepare_render(radeonContextPtr radeon) __DRIcontext *driContext = radeon->dri.context; __DRIdrawable *drawable; __DRIscreen *screen; + struct radeon_framebuffer *draw; screen = driContext->driScreenPriv; if (!screen->dri2.loader) @@ -524,9 +532,10 @@ void radeon_prepare_render(radeonContextPtr radeon) if (drawable->lastStamp != drawable->dri2.stamp) radeon_update_renderbuffers(driContext, drawable, GL_FALSE); - /* Intel driver does the equivalent of this, no clue if it is needed: - * radeon_draw_buffer(radeon->glCtx, &(drawable->driverPrivate)->base); - */ + /* Intel driver does the equivalent of this, no clue if it is needed:*/ + draw = drawable->driverPrivate; + radeon_draw_buffer(radeon->glCtx, &draw->base); + driContext->dri2.draw_stamp = drawable->dri2.stamp; } diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h b/src/mesa/drivers/dri/radeon/radeon_common_context.h index 024e31f8ec..c62913afd0 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h @@ -159,8 +159,8 @@ struct radeon_state_atom { GLuint *cmd; /* one or more cmd's */ GLuint *lastcmd; /* one or more cmd's */ GLboolean dirty; /* dirty-mark in emit_state_list */ - int (*check) (GLcontext *, struct radeon_state_atom *atom); /* is this state active? */ - void (*emit) (GLcontext *, struct radeon_state_atom *atom); + int (*check) (struct gl_context *, struct radeon_state_atom *atom); /* is this state active? */ + void (*emit) (struct gl_context *, struct radeon_state_atom *atom); }; struct radeon_hw_state { @@ -316,7 +316,7 @@ struct radeon_dma { * flush must be called before non-active vertex allocations can be * performed. */ - void (*flush) (GLcontext *); + void (*flush) (struct gl_context *); }; /* radeon_swtcl.c @@ -432,7 +432,7 @@ struct radeon_cmdbuf { }; struct radeon_context { - GLcontext *glCtx; + struct gl_context *glCtx; radeonScreenPtr radeonScreen; /* Screen private DRI data */ /* Texture object bookkeeping @@ -518,17 +518,17 @@ struct radeon_context { struct { void (*get_lock)(radeonContextPtr radeon); - void (*update_viewport_offset)(GLcontext *ctx); + void (*update_viewport_offset)(struct gl_context *ctx); void (*emit_cs_header)(struct radeon_cs *cs, radeonContextPtr rmesa); - void (*swtcl_flush)(GLcontext *ctx, uint32_t offset); + void (*swtcl_flush)(struct gl_context *ctx, uint32_t offset); void (*pre_emit_atoms)(radeonContextPtr rmesa); void (*pre_emit_state)(radeonContextPtr rmesa); - void (*fallback)(GLcontext *ctx, GLuint bit, GLboolean mode); - void (*free_context)(GLcontext *ctx); + void (*fallback)(struct gl_context *ctx, GLuint bit, GLboolean mode); + void (*free_context)(struct gl_context *ctx); void (*emit_query_finish)(radeonContextPtr radeon); - void (*update_scissor)(GLcontext *ctx); + void (*update_scissor)(struct gl_context *ctx); unsigned (*check_blit)(gl_format mesa_format); - unsigned (*blit)(GLcontext *ctx, + unsigned (*blit)(struct gl_context *ctx, struct radeon_bo *src_bo, intptr_t src_offset, gl_format src_mesaformat, @@ -611,7 +611,7 @@ static INLINE uint32_t radeonPackFloat24(float f) GLboolean radeonInitContext(radeonContextPtr radeon, struct dd_function_table* functions, - const __GLcontextModes * glVisual, + const struct gl_config * glVisual, __DRIcontext * driContextPriv, void *sharedContextPrivate); diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index ee65d7ff3d..cc9590213c 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -101,7 +101,6 @@ static const struct dri_extension card_extensions[] = { "GL_ATI_texture_mirror_once", NULL }, { "GL_MESA_ycbcr_texture", NULL }, { "GL_NV_blend_square", NULL }, - { "GL_SGIS_generate_mipmap", NULL }, { NULL, NULL } }; @@ -168,7 +167,7 @@ static void r100_vtbl_pre_emit_state(radeonContextPtr radeon) radeon->hw.is_dirty = 1; } -static void r100_vtbl_free_context(GLcontext *ctx) +static void r100_vtbl_free_context(struct gl_context *ctx) { r100ContextPtr rmesa = R100_CONTEXT(ctx); _mesa_vector4f_free( &rmesa->tcl.ObjClean ); @@ -207,7 +206,7 @@ static void r100_init_vtbl(radeonContextPtr radeon) */ GLboolean r100CreateContext( gl_api api, - const __GLcontextModes *glVisual, + const struct gl_config *glVisual, __DRIcontext *driContextPriv, void *sharedContextPrivate) { @@ -215,7 +214,7 @@ r100CreateContext( gl_api api, radeonScreenPtr screen = (radeonScreenPtr)(sPriv->private); struct dd_function_table functions; r100ContextPtr rmesa; - GLcontext *ctx; + struct gl_context *ctx; int i; int tcl_mode, fthrottle_mode; diff --git a/src/mesa/drivers/dri/radeon/radeon_context.h b/src/mesa/drivers/dri/radeon/radeon_context.h index c4bfbfdaeb..de71aa2c6d 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_context.h @@ -451,7 +451,7 @@ struct r100_context { #define RADEON_OLD_PACKETS 1 extern GLboolean r100CreateContext( gl_api api, - const __GLcontextModes *glVisual, + const struct gl_config *glVisual, __DRIcontext *driContextPriv, void *sharedContextPrivate); diff --git a/src/mesa/drivers/dri/radeon/radeon_dma.c b/src/mesa/drivers/dri/radeon/radeon_dma.c index 31a45169da..03d4e9656d 100644 --- a/src/mesa/drivers/dri/radeon/radeon_dma.c +++ b/src/mesa/drivers/dri/radeon/radeon_dma.c @@ -133,7 +133,7 @@ void radeonEmitVec16(uint32_t *out, const GLvoid * data, int stride, int count) } } -void rcommon_emit_vector(GLcontext * ctx, struct radeon_aos *aos, +void rcommon_emit_vector(struct gl_context * ctx, struct radeon_aos *aos, const GLvoid * data, int size, int stride, int count) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); @@ -389,7 +389,7 @@ void radeonReleaseDmaRegions(radeonContextPtr rmesa) /* Flush vertices in the current dma region. */ -void rcommon_flush_last_swtcl_prim( GLcontext *ctx ) +void rcommon_flush_last_swtcl_prim( struct gl_context *ctx ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); struct radeon_dma *dma = &rmesa->dma; @@ -462,7 +462,7 @@ rcommonAllocDmaLowVerts( radeonContextPtr rmesa, int nverts, int vsize ) return head; } -void radeonReleaseArrays( GLcontext *ctx, GLuint newinputs ) +void radeonReleaseArrays( struct gl_context *ctx, GLuint newinputs ) { radeonContextPtr radeon = RADEON_CONTEXT( ctx ); int i; diff --git a/src/mesa/drivers/dri/radeon/radeon_dma.h b/src/mesa/drivers/dri/radeon/radeon_dma.h index 74e653fd18..ad6a3b8baa 100644 --- a/src/mesa/drivers/dri/radeon/radeon_dma.h +++ b/src/mesa/drivers/dri/radeon/radeon_dma.h @@ -38,7 +38,7 @@ void radeonEmitVec8(uint32_t *out, const GLvoid * data, int stride, int count); void radeonEmitVec12(uint32_t *out, const GLvoid * data, int stride, int count); void radeonEmitVec16(uint32_t *out, const GLvoid * data, int stride, int count); -void rcommon_emit_vector(GLcontext * ctx, struct radeon_aos *aos, +void rcommon_emit_vector(struct gl_context * ctx, struct radeon_aos *aos, const GLvoid * data, int size, int stride, int count); void radeonReturnDmaRegion(radeonContextPtr rmesa, int return_bytes); @@ -50,9 +50,9 @@ void radeonAllocDmaRegion(radeonContextPtr rmesa, int bytes, int alignment); void radeonReleaseDmaRegions(radeonContextPtr rmesa); -void rcommon_flush_last_swtcl_prim(GLcontext *ctx); +void rcommon_flush_last_swtcl_prim(struct gl_context *ctx); void *rcommonAllocDmaLowVerts(radeonContextPtr rmesa, int nverts, int vsize); void radeonFreeDmaRegions(radeonContextPtr rmesa); -void radeonReleaseArrays( GLcontext *ctx, GLuint newinputs ); +void radeonReleaseArrays( struct gl_context *ctx, GLuint newinputs ); #endif diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index 0597d4250d..2a6fbaeaf0 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -47,7 +47,7 @@ } while(0) static struct gl_framebuffer * -radeon_new_framebuffer(GLcontext *ctx, GLuint name) +radeon_new_framebuffer(struct gl_context *ctx, GLuint name) { return _mesa_new_framebuffer(ctx, name); } @@ -70,7 +70,7 @@ radeon_delete_renderbuffer(struct gl_renderbuffer *rb) } static void * -radeon_get_pointer(GLcontext *ctx, struct gl_renderbuffer *rb, +radeon_get_pointer(struct gl_context *ctx, struct gl_renderbuffer *rb, GLint x, GLint y) { radeon_print(RADEON_TEXTURE, RADEON_TRACE, @@ -85,7 +85,7 @@ radeon_get_pointer(GLcontext *ctx, struct gl_renderbuffer *rb, * storage for a user-created renderbuffer. */ static GLboolean -radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, +radeon_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { @@ -206,7 +206,7 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, * Not used for user-created renderbuffers! */ static GLboolean -radeon_alloc_window_storage(GLcontext * ctx, struct gl_renderbuffer *rb, +radeon_alloc_window_storage(struct gl_context * ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { ASSERT(rb->Name == 0); @@ -223,7 +223,7 @@ radeon_alloc_window_storage(GLcontext * ctx, struct gl_renderbuffer *rb, static void -radeon_resize_buffers(GLcontext *ctx, struct gl_framebuffer *fb, +radeon_resize_buffers(struct gl_context *ctx, struct gl_framebuffer *fb, GLuint width, GLuint height) { struct radeon_framebuffer *radeon_fb = (struct radeon_framebuffer*)fb; @@ -255,7 +255,7 @@ radeon_resize_buffers(GLcontext *ctx, struct gl_framebuffer *fb, /** Dummy function for gl_renderbuffer::AllocStorage() */ static GLboolean -radeon_nop_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, +radeon_nop_alloc_storage(struct gl_context * ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { _mesa_problem(ctx, "radeon_op_alloc_storage should never be called."); @@ -352,7 +352,7 @@ radeon_create_renderbuffer(gl_format format, __DRIdrawable *driDrawPriv) } static struct gl_renderbuffer * -radeon_new_renderbuffer(GLcontext * ctx, GLuint name) +radeon_new_renderbuffer(struct gl_context * ctx, GLuint name) { struct radeon_renderbuffer *rrb; @@ -376,7 +376,7 @@ radeon_new_renderbuffer(GLcontext * ctx, GLuint name) } static void -radeon_bind_framebuffer(GLcontext * ctx, GLenum target, +radeon_bind_framebuffer(struct gl_context * ctx, GLenum target, struct gl_framebuffer *fb, struct gl_framebuffer *fbread) { radeon_print(RADEON_TEXTURE, RADEON_TRACE, @@ -393,7 +393,7 @@ radeon_bind_framebuffer(GLcontext * ctx, GLenum target, } static void -radeon_framebuffer_renderbuffer(GLcontext * ctx, +radeon_framebuffer_renderbuffer(struct gl_context * ctx, struct gl_framebuffer *fb, GLenum attachment, struct gl_renderbuffer *rb) { @@ -410,7 +410,7 @@ radeon_framebuffer_renderbuffer(GLcontext * ctx, } static GLboolean -radeon_update_wrapper(GLcontext *ctx, struct radeon_renderbuffer *rrb, +radeon_update_wrapper(struct gl_context *ctx, struct radeon_renderbuffer *rrb, struct gl_texture_image *texImage) { radeon_print(RADEON_TEXTURE, RADEON_TRACE, @@ -459,7 +459,7 @@ radeon_update_wrapper(GLcontext *ctx, struct radeon_renderbuffer *rrb, static struct radeon_renderbuffer * -radeon_wrap_texture(GLcontext * ctx, struct gl_texture_image *texImage) +radeon_wrap_texture(struct gl_context * ctx, struct gl_texture_image *texImage) { const GLuint name = ~0; /* not significant, but distinct for debugging */ struct radeon_renderbuffer *rrb; @@ -488,7 +488,7 @@ radeon_wrap_texture(GLcontext * ctx, struct gl_texture_image *texImage) } static void -radeon_render_texture(GLcontext * ctx, +radeon_render_texture(struct gl_context * ctx, struct gl_framebuffer *fb, struct gl_renderbuffer_attachment *att) { @@ -568,13 +568,13 @@ radeon_render_texture(GLcontext * ctx, } static void -radeon_finish_render_texture(GLcontext * ctx, +radeon_finish_render_texture(struct gl_context * ctx, struct gl_renderbuffer_attachment *att) { } static void -radeon_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) +radeon_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); gl_format mesa_format; diff --git a/src/mesa/drivers/dri/radeon/radeon_ioctl.c b/src/mesa/drivers/dri/radeon/radeon_ioctl.c index 5ac526c6de..a91d872779 100644 --- a/src/mesa/drivers/dri/radeon/radeon_ioctl.c +++ b/src/mesa/drivers/dri/radeon/radeon_ioctl.c @@ -44,7 +44,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/glheader.h" #include "main/imports.h" #include "main/simple_list.h" -#include "swrast/swrast.h" #include "radeon_context.h" #include "radeon_common.h" @@ -179,7 +178,7 @@ extern void radeonEmitVbufPrim( r100ContextPtr rmesa, #endif } -void radeonFlushElts( GLcontext *ctx ) +void radeonFlushElts( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); BATCH_LOCALS(&rmesa->radeon); @@ -433,7 +432,7 @@ void radeonEmitAOS( r100ContextPtr rmesa, */ #define RADEON_MAX_CLEARS 256 -static void radeonKernelClear(GLcontext *ctx, GLuint flags) +static void radeonKernelClear(struct gl_context *ctx, GLuint flags) { r100ContextPtr rmesa = R100_CONTEXT(ctx); __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon); @@ -556,7 +555,7 @@ static void radeonKernelClear(GLcontext *ctx, GLuint flags) UNLOCK_HARDWARE( &rmesa->radeon ); } -static void radeonClear( GLcontext *ctx, GLbitfield mask ) +static void radeonClear( struct gl_context *ctx, GLbitfield mask ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon); @@ -630,7 +629,7 @@ static void radeonClear( GLcontext *ctx, GLbitfield mask ) } } -void radeonInitIoctlFuncs( GLcontext *ctx ) +void radeonInitIoctlFuncs( struct gl_context *ctx ) { ctx->Driver.Clear = radeonClear; ctx->Driver.Finish = radeonFinish; diff --git a/src/mesa/drivers/dri/radeon/radeon_ioctl.h b/src/mesa/drivers/dri/radeon/radeon_ioctl.h index deb53ae313..790205719b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_ioctl.h +++ b/src/mesa/drivers/dri/radeon/radeon_ioctl.h @@ -50,7 +50,7 @@ extern void radeonEmitVbufPrim( r100ContextPtr rmesa, GLuint primitive, GLuint vertex_nr ); -extern void radeonFlushElts( GLcontext *ctx ); +extern void radeonFlushElts( struct gl_context *ctx ); extern GLushort *radeonAllocEltsOpenEnded( r100ContextPtr rmesa, @@ -77,9 +77,9 @@ extern void radeonEmitWait( r100ContextPtr rmesa, GLuint flags ); extern void radeonFlushCmdBuf( r100ContextPtr rmesa, const char * ); -extern void radeonFlush( GLcontext *ctx ); -extern void radeonFinish( GLcontext *ctx ); -extern void radeonInitIoctlFuncs( GLcontext *ctx ); +extern void radeonFlush( struct gl_context *ctx ); +extern void radeonFinish( struct gl_context *ctx ); +extern void radeonInitIoctlFuncs( struct gl_context *ctx ); extern void radeonGetAllParams( r100ContextPtr rmesa ); extern void radeonSetUpAtomList( r100ContextPtr rmesa ); diff --git a/src/mesa/drivers/dri/radeon/radeon_maos.h b/src/mesa/drivers/dri/radeon/radeon_maos.h index b88eb198d5..0feea35815 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos.h +++ b/src/mesa/drivers/dri/radeon/radeon_maos.h @@ -37,6 +37,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "radeon_context.h" -extern void radeonEmitArrays( GLcontext *ctx, GLuint inputs ); +extern void radeonEmitArrays( struct gl_context *ctx, GLuint inputs ); #endif diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c index d810e6080e..94fe7e4b9f 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c +++ b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c @@ -48,7 +48,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "radeon_maos.h" #include "radeon_tcl.h" -static void emit_vecfog(GLcontext *ctx, struct radeon_aos *aos, +static void emit_vecfog(struct gl_context *ctx, struct radeon_aos *aos, GLvoid *data, int stride, int count) { int i; @@ -121,7 +121,7 @@ static void emit_stq_vec(uint32_t *out, GLvoid *data, int stride, int count) -static void emit_tex_vector(GLcontext *ctx, struct radeon_aos *aos, +static void emit_tex_vector(struct gl_context *ctx, struct radeon_aos *aos, GLvoid *data, int size, int stride, int count) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); @@ -182,7 +182,7 @@ static void emit_tex_vector(GLcontext *ctx, struct radeon_aos *aos, /* Emit any changed arrays to new GART memory, re-emit a packet to * update the arrays. */ -void radeonEmitArrays( GLcontext *ctx, GLuint inputs ) +void radeonEmitArrays( struct gl_context *ctx, GLuint inputs ) { r100ContextPtr rmesa = R100_CONTEXT( ctx ); struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb; diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h index d764ccb982..b73fc8abfe 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h +++ b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h @@ -34,7 +34,7 @@ #define TCL_DEBUG 0 #endif -static void TAG(emit)( GLcontext *ctx, +static void TAG(emit)( struct gl_context *ctx, GLuint start, GLuint end, void *dest ) { diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c index 98f96ff2a7..5dac2a362b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c +++ b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c @@ -40,7 +40,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "math/m_translate.h" #include "tnl/tnl.h" #include "tnl/t_pipeline.h" -#include "math/m_translate.h" #include "radeon_context.h" #include "radeon_state.h" #include "radeon_ioctl.h" @@ -55,7 +54,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. union emit_union { float f; GLuint ui; radeon_color_t rgba; }; static struct { - void (*emit)( GLcontext *, GLuint, GLuint, void * ); + void (*emit)( struct gl_context *, GLuint, GLuint, void * ); GLuint vertex_size; GLuint vertex_format; } setup_tab[RADEON_TCL_MAX_SETUP]; @@ -308,7 +307,7 @@ static void init_tcl_verts( void ) } -void radeonEmitArrays( GLcontext *ctx, GLuint inputs ) +void radeonEmitArrays( struct gl_context *ctx, GLuint inputs ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index ddfde3edaf..1fadad2756 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -578,7 +578,7 @@ static radeon_mipmap_tree * get_biggest_matching_miptree(radeonTexObj *texObj, * If individual images are stored in different mipmap trees * use the mipmap tree that has the most of the correct data. */ -int radeon_validate_texture_miptree(GLcontext * ctx, struct gl_texture_object *texObj) +int radeon_validate_texture_miptree(struct gl_context * ctx, struct gl_texture_object *texObj) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); radeonTexObj *t = radeon_tex_obj(texObj); diff --git a/src/mesa/drivers/dri/radeon/radeon_pixel_read.c b/src/mesa/drivers/dri/radeon/radeon_pixel_read.c index 216eb932db..e44d6f2f8f 100644 --- a/src/mesa/drivers/dri/radeon/radeon_pixel_read.c +++ b/src/mesa/drivers/dri/radeon/radeon_pixel_read.c @@ -86,7 +86,7 @@ static gl_format gl_format_and_type_to_mesa_format(GLenum format, GLenum type) } static GLboolean -do_blit_readpixels(GLcontext * ctx, +do_blit_readpixels(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *pack, GLvoid * pixels) @@ -194,7 +194,7 @@ do_blit_readpixels(GLcontext * ctx, } void -radeonReadPixels(GLcontext * ctx, +radeonReadPixels(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *pack, GLvoid * pixels) diff --git a/src/mesa/drivers/dri/radeon/radeon_queryobj.c b/src/mesa/drivers/dri/radeon/radeon_queryobj.c index 5b7178bcca..a45ca7cad0 100644 --- a/src/mesa/drivers/dri/radeon/radeon_queryobj.c +++ b/src/mesa/drivers/dri/radeon/radeon_queryobj.c @@ -33,7 +33,7 @@ #include <inttypes.h> -static void radeonQueryGetResult(GLcontext *ctx, struct gl_query_object *q) +static void radeonQueryGetResult(struct gl_context *ctx, struct gl_query_object *q) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); struct radeon_query_object *query = (struct radeon_query_object *)q; @@ -79,7 +79,7 @@ static void radeonQueryGetResult(GLcontext *ctx, struct gl_query_object *q) radeon_bo_unmap(query->bo); } -static struct gl_query_object * radeonNewQueryObject(GLcontext *ctx, GLuint id) +static struct gl_query_object * radeonNewQueryObject(struct gl_context *ctx, GLuint id) { struct radeon_query_object *query; @@ -95,7 +95,7 @@ static struct gl_query_object * radeonNewQueryObject(GLcontext *ctx, GLuint id) return &query->Base; } -static void radeonDeleteQuery(GLcontext *ctx, struct gl_query_object *q) +static void radeonDeleteQuery(struct gl_context *ctx, struct gl_query_object *q) { struct radeon_query_object *query = (struct radeon_query_object *)q; @@ -108,7 +108,7 @@ static void radeonDeleteQuery(GLcontext *ctx, struct gl_query_object *q) free(query); } -static void radeonWaitQuery(GLcontext *ctx, struct gl_query_object *q) +static void radeonWaitQuery(struct gl_context *ctx, struct gl_query_object *q) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); struct radeon_query_object *query = (struct radeon_query_object *)q; @@ -125,7 +125,7 @@ static void radeonWaitQuery(GLcontext *ctx, struct gl_query_object *q) } -static void radeonBeginQuery(GLcontext *ctx, struct gl_query_object *q) +static void radeonBeginQuery(struct gl_context *ctx, struct gl_query_object *q) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); struct radeon_query_object *query = (struct radeon_query_object *)q; @@ -148,7 +148,7 @@ static void radeonBeginQuery(GLcontext *ctx, struct gl_query_object *q) radeon->hw.is_dirty = GL_TRUE; } -void radeonEmitQueryEnd(GLcontext *ctx) +void radeonEmitQueryEnd(struct gl_context *ctx) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); struct radeon_query_object *query = radeon->query.current; @@ -168,7 +168,7 @@ void radeonEmitQueryEnd(GLcontext *ctx) radeon->vtbl.emit_query_finish(radeon); } -static void radeonEndQuery(GLcontext *ctx, struct gl_query_object *q) +static void radeonEndQuery(struct gl_context *ctx, struct gl_query_object *q) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); @@ -181,7 +181,7 @@ static void radeonEndQuery(GLcontext *ctx, struct gl_query_object *q) radeon->query.current = NULL; } -static void radeonCheckQuery(GLcontext *ctx, struct gl_query_object *q) +static void radeonCheckQuery(struct gl_context *ctx, struct gl_query_object *q) { radeon_print(RADEON_STATE, RADEON_TRACE, "%s: query id %d\n", __FUNCTION__, q->Id); @@ -219,7 +219,7 @@ void radeonInitQueryObjFunctions(struct dd_function_table *functions) functions->WaitQuery = radeonWaitQuery; } -int radeon_check_query_active(GLcontext *ctx, struct radeon_state_atom *atom) +int radeon_check_query_active(struct gl_context *ctx, struct radeon_state_atom *atom) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); struct radeon_query_object *query = radeon->query.current; @@ -229,7 +229,7 @@ int radeon_check_query_active(GLcontext *ctx, struct radeon_state_atom *atom) return atom->cmd_size; } -void radeon_emit_queryobj(GLcontext *ctx, struct radeon_state_atom *atom) +void radeon_emit_queryobj(struct gl_context *ctx, struct radeon_state_atom *atom) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); BATCH_LOCALS(radeon); diff --git a/src/mesa/drivers/dri/radeon/radeon_queryobj.h b/src/mesa/drivers/dri/radeon/radeon_queryobj.h index 19374dc76b..e506393482 100644 --- a/src/mesa/drivers/dri/radeon/radeon_queryobj.h +++ b/src/mesa/drivers/dri/radeon/radeon_queryobj.h @@ -29,15 +29,15 @@ #include "main/simple_list.h" #include "radeon_common_context.h" -extern void radeonEmitQueryBegin(GLcontext *ctx); -extern void radeonEmitQueryEnd(GLcontext *ctx); +extern void radeonEmitQueryBegin(struct gl_context *ctx); +extern void radeonEmitQueryEnd(struct gl_context *ctx); extern void radeonInitQueryObjFunctions(struct dd_function_table *functions); #define RADEON_QUERY_PAGE_SIZE 4096 -int radeon_check_query_active(GLcontext *ctx, struct radeon_state_atom *atom); -void radeon_emit_queryobj(GLcontext *ctx, struct radeon_state_atom *atom); +int radeon_check_query_active(struct gl_context *ctx, struct radeon_state_atom *atom); +void radeon_emit_queryobj(struct gl_context *ctx, struct radeon_state_atom *atom); static inline void radeon_init_query_stateobj(radeonContextPtr radeon, int SZ) { diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 2ea77e56c7..43ebc81093 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -258,7 +258,7 @@ radeonFillInModes( __DRIscreen *psp, unsigned stencil_bits, GLboolean have_back_buffer ) { __DRIconfig **configs; - __GLcontextModes *m; + struct gl_config *m; unsigned depth_buffer_factor; unsigned back_buffer_factor; int i; @@ -1583,7 +1583,7 @@ radeonInitDriver( __DRIscreen *sPriv ) static GLboolean radeonCreateBuffer( __DRIscreen *driScrnPriv, __DRIdrawable *driDrawPriv, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, GLboolean isPixmap ) { radeonScreenPtr screen = (radeonScreenPtr) driScrnPriv->private; @@ -1691,7 +1691,7 @@ radeonDestroyBuffer(__DRIdrawable *driDrawPriv) if (!rfb) return; radeon_cleanup_renderbuffers(rfb); - _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL); + _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL); } @@ -1700,7 +1700,7 @@ radeonDestroyBuffer(__DRIdrawable *driDrawPriv) * * \todo maybe fold this into intelInitDriver * - * \return the __GLcontextModes supported by this driver + * \return the struct gl_config supported by this driver */ static const __DRIconfig ** radeonInitScreen(__DRIscreen *psp) @@ -1750,7 +1750,7 @@ radeonInitScreen(__DRIscreen *psp) * This is the driver specific part of the createNewScreen entry point. * Called when using DRI2. * - * \return the __GLcontextModes supported by this driver + * \return the struct gl_config supported by this driver */ static const __DRIconfig **radeonInitScreen2(__DRIscreen *psp) diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c index 9dfe2dd243..1c5326fe9d 100644 --- a/src/mesa/drivers/dri/radeon/radeon_span.c +++ b/src/mesa/drivers/dri/radeon/radeon_span.c @@ -1015,7 +1015,7 @@ static void map_unmap_rb(struct gl_renderbuffer *rb, int flag) } static void -radeon_map_unmap_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb, +radeon_map_unmap_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb, GLboolean map) { GLuint i, j; @@ -1060,7 +1060,7 @@ radeon_map_unmap_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb, radeon_check_front_buffer_rendering(ctx); } -static void radeonSpanRenderStart(GLcontext * ctx) +static void radeonSpanRenderStart(struct gl_context * ctx) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); int i; @@ -1087,7 +1087,7 @@ static void radeonSpanRenderStart(GLcontext * ctx) radeon_map_unmap_framebuffer(ctx, ctx->ReadBuffer, GL_TRUE); } -static void radeonSpanRenderFinish(GLcontext * ctx) +static void radeonSpanRenderFinish(struct gl_context * ctx) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); int i; @@ -1108,7 +1108,7 @@ static void radeonSpanRenderFinish(GLcontext * ctx) } } -void radeonInitSpanFuncs(GLcontext * ctx) +void radeonInitSpanFuncs(struct gl_context * ctx) { struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx); diff --git a/src/mesa/drivers/dri/radeon/radeon_span.h b/src/mesa/drivers/dri/radeon/radeon_span.h index ea6a2e7fb4..64517b5923 100644 --- a/src/mesa/drivers/dri/radeon/radeon_span.h +++ b/src/mesa/drivers/dri/radeon/radeon_span.h @@ -42,6 +42,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef __RADEON_SPAN_H__ #define __RADEON_SPAN_H__ -extern void radeonInitSpanFuncs(GLcontext * ctx); +extern void radeonInitSpanFuncs(struct gl_context * ctx); #endif diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c index 539b067742..cae12f192c 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.c +++ b/src/mesa/drivers/dri/radeon/radeon_state.c @@ -55,13 +55,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "radeon_tex.h" #include "radeon_swtcl.h" -static void radeonUpdateSpecular( GLcontext *ctx ); +static void radeonUpdateSpecular( struct gl_context *ctx ); /* ============================================================= * Alpha blending */ -static void radeonAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) +static void radeonAlphaFunc( struct gl_context *ctx, GLenum func, GLfloat ref ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); int pp_misc = rmesa->hw.ctx.cmd[CTX_PP_MISC]; @@ -104,7 +104,7 @@ static void radeonAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) rmesa->hw.ctx.cmd[CTX_PP_MISC] = pp_misc; } -static void radeonBlendEquationSeparate( GLcontext *ctx, +static void radeonBlendEquationSeparate( struct gl_context *ctx, GLenum modeRGB, GLenum modeA ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -144,7 +144,7 @@ static void radeonBlendEquationSeparate( GLcontext *ctx, } } -static void radeonBlendFuncSeparate( GLcontext *ctx, +static void radeonBlendFuncSeparate( struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) { @@ -256,7 +256,7 @@ static void radeonBlendFuncSeparate( GLcontext *ctx, * Depth testing */ -static void radeonDepthFunc( GLcontext *ctx, GLenum func ) +static void radeonDepthFunc( struct gl_context *ctx, GLenum func ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -292,7 +292,7 @@ static void radeonDepthFunc( GLcontext *ctx, GLenum func ) } -static void radeonDepthMask( GLcontext *ctx, GLboolean flag ) +static void radeonDepthMask( struct gl_context *ctx, GLboolean flag ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); RADEON_STATECHANGE( rmesa, ctx ); @@ -304,7 +304,7 @@ static void radeonDepthMask( GLcontext *ctx, GLboolean flag ) } } -static void radeonClearDepth( GLcontext *ctx, GLclampd d ) +static void radeonClearDepth( struct gl_context *ctx, GLclampd d ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLuint format = (rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] & @@ -326,7 +326,7 @@ static void radeonClearDepth( GLcontext *ctx, GLclampd d ) */ -static void radeonFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) +static void radeonFogfv( struct gl_context *ctx, GLenum pname, const GLfloat *param ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); union { int i; float f; } c, d; @@ -411,7 +411,7 @@ static void radeonFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) * Culling */ -static void radeonCullFace( GLcontext *ctx, GLenum unused ) +static void radeonCullFace( struct gl_context *ctx, GLenum unused ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLuint s = rmesa->hw.set.cmd[SET_SE_CNTL]; @@ -448,7 +448,7 @@ static void radeonCullFace( GLcontext *ctx, GLenum unused ) } } -static void radeonFrontFace( GLcontext *ctx, GLenum mode ) +static void radeonFrontFace( struct gl_context *ctx, GLenum mode ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -477,7 +477,7 @@ static void radeonFrontFace( GLcontext *ctx, GLenum mode ) /* ============================================================= * Line state */ -static void radeonLineWidth( GLcontext *ctx, GLfloat widthf ) +static void radeonLineWidth( struct gl_context *ctx, GLfloat widthf ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -494,7 +494,7 @@ static void radeonLineWidth( GLcontext *ctx, GLfloat widthf ) } } -static void radeonLineStipple( GLcontext *ctx, GLint factor, GLushort pattern ) +static void radeonLineStipple( struct gl_context *ctx, GLint factor, GLushort pattern ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -507,7 +507,7 @@ static void radeonLineStipple( GLcontext *ctx, GLint factor, GLushort pattern ) /* ============================================================= * Masks */ -static void radeonColorMask( GLcontext *ctx, +static void radeonColorMask( struct gl_context *ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) { @@ -536,7 +536,7 @@ static void radeonColorMask( GLcontext *ctx, * Polygon state */ -static void radeonPolygonOffset( GLcontext *ctx, +static void radeonPolygonOffset( struct gl_context *ctx, GLfloat factor, GLfloat units ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -549,7 +549,7 @@ static void radeonPolygonOffset( GLcontext *ctx, rmesa->hw.zbs.cmd[ZBS_SE_ZBIAS_CONSTANT] = constant.ui32; } -static void radeonPolygonStipplePreKMS( GLcontext *ctx, const GLubyte *mask ) +static void radeonPolygonStipplePreKMS( struct gl_context *ctx, const GLubyte *mask ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLuint i; @@ -574,7 +574,7 @@ static void radeonPolygonStipplePreKMS( GLcontext *ctx, const GLubyte *mask ) UNLOCK_HARDWARE( &rmesa->radeon ); } -static void radeonPolygonMode( GLcontext *ctx, GLenum face, GLenum mode ) +static void radeonPolygonMode( struct gl_context *ctx, GLenum face, GLenum mode ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLboolean flag = (ctx->_TriangleCaps & DD_TRI_UNFILLED) != 0; @@ -601,7 +601,7 @@ static void radeonPolygonMode( GLcontext *ctx, GLenum face, GLenum mode ) /* Examine lighting and texture state to determine if separate specular * should be enabled. */ -static void radeonUpdateSpecular( GLcontext *ctx ) +static void radeonUpdateSpecular( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); uint32_t p = rmesa->hw.ctx.cmd[CTX_PP_CNTL]; @@ -689,7 +689,7 @@ static void radeonUpdateSpecular( GLcontext *ctx ) /* Update on colormaterial, material emmissive/ambient, * lightmodel.globalambient */ -static void update_global_ambient( GLcontext *ctx ) +static void update_global_ambient( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); float *fcmd = (float *)RADEON_DB_STATE( glt ); @@ -719,7 +719,7 @@ static void update_global_ambient( GLcontext *ctx ) * - light[p].colors * - light[p].enabled */ -static void update_light_colors( GLcontext *ctx, GLuint p ) +static void update_light_colors( struct gl_context *ctx, GLuint p ) { struct gl_light *l = &ctx->Light.Light[p]; @@ -739,7 +739,7 @@ static void update_light_colors( GLcontext *ctx, GLuint p ) /* Also fallback for asym colormaterial mode in twoside lighting... */ -static void check_twoside_fallback( GLcontext *ctx ) +static void check_twoside_fallback( struct gl_context *ctx ) { GLboolean fallback = GL_FALSE; GLint i; @@ -764,7 +764,7 @@ static void check_twoside_fallback( GLcontext *ctx ) } -static void radeonColorMaterial( GLcontext *ctx, GLenum face, GLenum mode ) +static void radeonColorMaterial( struct gl_context *ctx, GLenum face, GLenum mode ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLuint light_model_ctl1 = rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL]; @@ -828,7 +828,7 @@ static void radeonColorMaterial( GLcontext *ctx, GLenum face, GLenum mode ) } } -void radeonUpdateMaterial( GLcontext *ctx ) +void radeonUpdateMaterial( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLfloat (*mat)[4] = ctx->Light.Material.Attrib; @@ -893,7 +893,7 @@ void radeonUpdateMaterial( GLcontext *ctx ) * lighting space (model or eye), hence dependencies on _NEW_MODELVIEW * and _MESA_NEW_NEED_EYE_COORDS. */ -static void update_light( GLcontext *ctx ) +static void update_light( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -957,7 +957,7 @@ static void update_light( GLcontext *ctx ) } } -static void radeonLightfv( GLcontext *ctx, GLenum light, +static void radeonLightfv( struct gl_context *ctx, GLenum light, GLenum pname, const GLfloat *params ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -1078,7 +1078,7 @@ static void radeonLightfv( GLcontext *ctx, GLenum light, -static void radeonLightModelfv( GLcontext *ctx, GLenum pname, +static void radeonLightModelfv( struct gl_context *ctx, GLenum pname, const GLfloat *param ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -1120,7 +1120,7 @@ static void radeonLightModelfv( GLcontext *ctx, GLenum pname, } } -static void radeonShadeModel( GLcontext *ctx, GLenum mode ) +static void radeonShadeModel( struct gl_context *ctx, GLenum mode ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLuint s = rmesa->hw.set.cmd[SET_SE_CNTL]; @@ -1158,7 +1158,7 @@ static void radeonShadeModel( GLcontext *ctx, GLenum mode ) * User clip planes */ -static void radeonClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq ) +static void radeonClipPlane( struct gl_context *ctx, GLenum plane, const GLfloat *eq ) { GLint p = (GLint) plane - (GLint) GL_CLIP_PLANE0; r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -1171,7 +1171,7 @@ static void radeonClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq ) rmesa->hw.ucp[p].cmd[UCP_W] = ip[3]; } -static void radeonUpdateClipPlanes( GLcontext *ctx ) +static void radeonUpdateClipPlanes( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLuint p; @@ -1195,7 +1195,7 @@ static void radeonUpdateClipPlanes( GLcontext *ctx ) */ static void -radeonStencilFuncSeparate( GLcontext *ctx, GLenum face, GLenum func, +radeonStencilFuncSeparate( struct gl_context *ctx, GLenum face, GLenum func, GLint ref, GLuint mask ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -1240,7 +1240,7 @@ radeonStencilFuncSeparate( GLcontext *ctx, GLenum face, GLenum func, } static void -radeonStencilMaskSeparate( GLcontext *ctx, GLenum face, GLuint mask ) +radeonStencilMaskSeparate( struct gl_context *ctx, GLenum face, GLuint mask ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -1250,7 +1250,7 @@ radeonStencilMaskSeparate( GLcontext *ctx, GLenum face, GLuint mask ) ((ctx->Stencil.WriteMask[0] & 0xff) << RADEON_STENCIL_WRITEMASK_SHIFT); } -static void radeonStencilOpSeparate( GLcontext *ctx, GLenum face, GLenum fail, +static void radeonStencilOpSeparate( struct gl_context *ctx, GLenum face, GLenum fail, GLenum zfail, GLenum zpass ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -1370,7 +1370,7 @@ static void radeonStencilOpSeparate( GLcontext *ctx, GLenum face, GLenum fail, } } -static void radeonClearStencil( GLcontext *ctx, GLint s ) +static void radeonClearStencil( struct gl_context *ctx, GLint s ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -1396,7 +1396,7 @@ static void radeonClearStencil( GLcontext *ctx, GLint s ) * Called when window size or position changes or viewport or depth range * state is changed. We update the hardware viewport state here. */ -void radeonUpdateWindow( GLcontext *ctx ) +void radeonUpdateWindow( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon); @@ -1433,7 +1433,7 @@ void radeonUpdateWindow( GLcontext *ctx ) } -static void radeonViewport( GLcontext *ctx, GLint x, GLint y, +static void radeonViewport( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) { /* Don't pipeline viewport changes, conflict with window offset @@ -1445,13 +1445,13 @@ static void radeonViewport( GLcontext *ctx, GLint x, GLint y, radeon_viewport(ctx, x, y, width, height); } -static void radeonDepthRange( GLcontext *ctx, GLclampd nearval, +static void radeonDepthRange( struct gl_context *ctx, GLclampd nearval, GLclampd farval ) { radeonUpdateWindow( ctx ); } -void radeonUpdateViewportOffset( GLcontext *ctx ) +void radeonUpdateViewportOffset( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon); @@ -1507,7 +1507,7 @@ void radeonUpdateViewportOffset( GLcontext *ctx ) * Miscellaneous */ -static void radeonClearColor( GLcontext *ctx, const GLfloat color[4] ) +static void radeonClearColor( struct gl_context *ctx, const GLfloat color[4] ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLubyte c[4]; @@ -1526,7 +1526,7 @@ static void radeonClearColor( GLcontext *ctx, const GLfloat color[4] ) } -static void radeonRenderMode( GLcontext *ctx, GLenum mode ) +static void radeonRenderMode( struct gl_context *ctx, GLenum mode ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); FALLBACK( rmesa, RADEON_FALLBACK_RENDER_MODE, (mode != GL_RENDER) ); @@ -1552,7 +1552,7 @@ static GLuint radeon_rop_tab[] = { RADEON_ROP_SET, }; -static void radeonLogicOpCode( GLcontext *ctx, GLenum opcode ) +static void radeonLogicOpCode( struct gl_context *ctx, GLenum opcode ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLuint rop = (GLuint)opcode - GL_CLEAR; @@ -1567,7 +1567,7 @@ static void radeonLogicOpCode( GLcontext *ctx, GLenum opcode ) * State enable/disable */ -static void radeonEnable( GLcontext *ctx, GLenum cap, GLboolean state ) +static void radeonEnable( struct gl_context *ctx, GLenum cap, GLboolean state ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLuint p, flag; @@ -1860,7 +1860,7 @@ static void radeonEnable( GLcontext *ctx, GLenum cap, GLboolean state ) } -static void radeonLightingSpaceChange( GLcontext *ctx ) +static void radeonLightingSpaceChange( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLboolean tmp; @@ -1995,7 +1995,7 @@ static void upload_matrix_t( r100ContextPtr rmesa, GLfloat *src, int idx ) } -static void update_texturematrix( GLcontext *ctx ) +static void update_texturematrix( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT( ctx ); GLuint tpc = rmesa->hw.tcl.cmd[TCL_TEXTURE_PROC_CTL]; @@ -2061,7 +2061,7 @@ static void update_texturematrix( GLcontext *ctx ) } } -static GLboolean r100ValidateBuffers(GLcontext *ctx) +static GLboolean r100ValidateBuffers(struct gl_context *ctx) { r100ContextPtr rmesa = R100_CONTEXT(ctx); struct radeon_renderbuffer *rrb; @@ -2105,7 +2105,7 @@ static GLboolean r100ValidateBuffers(GLcontext *ctx) return GL_TRUE; } -GLboolean radeonValidateState( GLcontext *ctx ) +GLboolean radeonValidateState( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLuint new_state = rmesa->radeon.NewGLState; @@ -2163,7 +2163,7 @@ GLboolean radeonValidateState( GLcontext *ctx ) } -static void radeonInvalidateState( GLcontext *ctx, GLuint new_state ) +static void radeonInvalidateState( struct gl_context *ctx, GLuint new_state ) { _swrast_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); @@ -2176,7 +2176,7 @@ static void radeonInvalidateState( GLcontext *ctx, GLuint new_state ) /* A hack. Need a faster way to find this out. */ -static GLboolean check_material( GLcontext *ctx ) +static GLboolean check_material( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLint i; @@ -2192,7 +2192,7 @@ static GLboolean check_material( GLcontext *ctx ) } -static void radeonWrapRunPipeline( GLcontext *ctx ) +static void radeonWrapRunPipeline( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLboolean has_material; @@ -2221,7 +2221,7 @@ static void radeonWrapRunPipeline( GLcontext *ctx ) } } -static void radeonPolygonStipple( GLcontext *ctx, const GLubyte *mask ) +static void radeonPolygonStipple( struct gl_context *ctx, const GLubyte *mask ) { r100ContextPtr r100 = R100_CONTEXT(ctx); GLint i; @@ -2242,7 +2242,7 @@ static void radeonPolygonStipple( GLcontext *ctx, const GLubyte *mask ) * Many of the ctx->Driver functions might have been initialized to * software defaults in the earlier _mesa_init_driver_functions() call. */ -void radeonInitStateFuncs( GLcontext *ctx , GLboolean dri2 ) +void radeonInitStateFuncs( struct gl_context *ctx , GLboolean dri2 ) { ctx->Driver.UpdateState = radeonInvalidateState; ctx->Driver.LightingSpaceChange = radeonLightingSpaceChange; diff --git a/src/mesa/drivers/dri/radeon/radeon_state.h b/src/mesa/drivers/dri/radeon/radeon_state.h index c780cff0cf..9a011e11b2 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.h +++ b/src/mesa/drivers/dri/radeon/radeon_state.h @@ -40,20 +40,20 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "radeon_context.h" extern void radeonInitState( r100ContextPtr rmesa ); -extern void radeonInitStateFuncs( GLcontext *ctx , GLboolean dri2); +extern void radeonInitStateFuncs( struct gl_context *ctx , GLboolean dri2); -extern void radeonUpdateMaterial( GLcontext *ctx ); +extern void radeonUpdateMaterial( struct gl_context *ctx ); -extern void radeonUpdateViewportOffset( GLcontext *ctx ); -extern void radeonUpdateWindow( GLcontext *ctx ); -extern void radeonUpdateDrawBuffer( GLcontext *ctx ); +extern void radeonUpdateViewportOffset( struct gl_context *ctx ); +extern void radeonUpdateWindow( struct gl_context *ctx ); +extern void radeonUpdateDrawBuffer( struct gl_context *ctx ); extern void radeonUploadTexMatrix( r100ContextPtr rmesa, int unit, GLboolean swapcols ); -extern GLboolean radeonValidateState( GLcontext *ctx ); +extern GLboolean radeonValidateState( struct gl_context *ctx ); -extern void radeonFallback( GLcontext *ctx, GLuint bit, GLboolean mode ); +extern void radeonFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ); #define FALLBACK( rmesa, bit, mode ) do { \ if ( 0 ) fprintf( stderr, "FALLBACK in %s: #%d=%d\n", \ __FUNCTION__, bit, mode ); \ diff --git a/src/mesa/drivers/dri/radeon/radeon_state_init.c b/src/mesa/drivers/dri/radeon/radeon_state_init.c index 91718a4777..698efb145c 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state_init.c +++ b/src/mesa/drivers/dri/radeon/radeon_state_init.c @@ -195,13 +195,13 @@ static int cmdscl( int offset, int stride, int count ) } #define CHECK( NM, FLAG, ADD ) \ -static int check_##NM( GLcontext *ctx, struct radeon_state_atom *atom ) \ +static int check_##NM( struct gl_context *ctx, struct radeon_state_atom *atom ) \ { \ return FLAG ? atom->cmd_size + (ADD) : 0; \ } #define TCL_CHECK( NM, FLAG, ADD ) \ -static int check_##NM( GLcontext *ctx, struct radeon_state_atom *atom ) \ +static int check_##NM( struct gl_context *ctx, struct radeon_state_atom *atom ) \ { \ r100ContextPtr rmesa = R100_CONTEXT(ctx); \ return (!rmesa->radeon.TclFallback && (FLAG)) ? atom->cmd_size + (ADD) : 0; \ @@ -294,7 +294,7 @@ CHECK( txr2, (ctx->Texture.Unit[2]._ReallyEnabled & TEXTURE_RECT_BIT), 0 ) OUT_BATCH_TABLE((data), h.scalars.count); \ } while(0) -static void scl_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void scl_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r100ContextPtr r100 = R100_CONTEXT(ctx); BATCH_LOCALS(&r100->radeon); @@ -306,7 +306,7 @@ static void scl_emit(GLcontext *ctx, struct radeon_state_atom *atom) } -static void vec_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void vec_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r100ContextPtr r100 = R100_CONTEXT(ctx); BATCH_LOCALS(&r100->radeon); @@ -318,7 +318,7 @@ static void vec_emit(GLcontext *ctx, struct radeon_state_atom *atom) } -static void lit_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void lit_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r100ContextPtr r100 = R100_CONTEXT(ctx); BATCH_LOCALS(&r100->radeon); @@ -330,7 +330,7 @@ static void lit_emit(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static void ctx_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void ctx_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r100ContextPtr r100 = R100_CONTEXT(ctx); BATCH_LOCALS(&r100->radeon); @@ -395,7 +395,7 @@ static void ctx_emit(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static int check_always_ctx( GLcontext *ctx, struct radeon_state_atom *atom) +static int check_always_ctx( struct gl_context *ctx, struct radeon_state_atom *atom) { r100ContextPtr r100 = R100_CONTEXT(ctx); struct radeon_renderbuffer *rrb, *drb; @@ -417,7 +417,7 @@ static int check_always_ctx( GLcontext *ctx, struct radeon_state_atom *atom) return dwords; } -static void ctx_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) +static void ctx_emit_cs(struct gl_context *ctx, struct radeon_state_atom *atom) { r100ContextPtr r100 = R100_CONTEXT(ctx); BATCH_LOCALS(&r100->radeon); @@ -512,7 +512,7 @@ static void ctx_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static void cube_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void cube_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r100ContextPtr r100 = R100_CONTEXT(ctx); BATCH_LOCALS(&r100->radeon); @@ -540,7 +540,7 @@ static void cube_emit(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static void cube_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) +static void cube_emit_cs(struct gl_context *ctx, struct radeon_state_atom *atom) { r100ContextPtr r100 = R100_CONTEXT(ctx); BATCH_LOCALS(&r100->radeon); @@ -576,7 +576,7 @@ static void cube_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static void tex_emit(GLcontext *ctx, struct radeon_state_atom *atom) +static void tex_emit(struct gl_context *ctx, struct radeon_state_atom *atom) { r100ContextPtr r100 = R100_CONTEXT(ctx); BATCH_LOCALS(&r100->radeon); @@ -611,7 +611,7 @@ static void tex_emit(GLcontext *ctx, struct radeon_state_atom *atom) END_BATCH(); } -static void tex_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) +static void tex_emit_cs(struct gl_context *ctx, struct radeon_state_atom *atom) { r100ContextPtr r100 = R100_CONTEXT(ctx); BATCH_LOCALS(&r100->radeon); @@ -666,7 +666,7 @@ static void tex_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) */ void radeonInitState( r100ContextPtr rmesa ) { - GLcontext *ctx = rmesa->radeon.glCtx; + struct gl_context *ctx = rmesa->radeon.glCtx; GLuint i; rmesa->radeon.state.color.clear = 0x00000000; diff --git a/src/mesa/drivers/dri/radeon/radeon_swtcl.c b/src/mesa/drivers/dri/radeon/radeon_swtcl.c index 29defe73a7..f5b0df6ef5 100644 --- a/src/mesa/drivers/dri/radeon/radeon_swtcl.c +++ b/src/mesa/drivers/dri/radeon/radeon_swtcl.c @@ -87,7 +87,7 @@ static GLuint radeon_cp_vc_frmts[3][2] = { RADEON_CP_VC_FRMT_ST2, RADEON_CP_VC_FRMT_ST2 | RADEON_CP_VC_FRMT_Q2 }, }; -static void radeonSetVertexFormat( GLcontext *ctx ) +static void radeonSetVertexFormat( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -243,7 +243,7 @@ static void radeon_predict_emit_size( r100ContextPtr rmesa ) } } -static void radeonRenderStart( GLcontext *ctx ) +static void radeonRenderStart( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT( ctx ); @@ -260,7 +260,7 @@ static void radeonRenderStart( GLcontext *ctx ) * determine in advance whether or not the hardware can / should do the * projection divide or Mesa should do it. */ -void radeonChooseVertexState( GLcontext *ctx ) +void radeonChooseVertexState( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -302,7 +302,7 @@ void radeonChooseVertexState( GLcontext *ctx ) } } -void r100_swtcl_flush(GLcontext *ctx, uint32_t current_offset) +void r100_swtcl_flush(struct gl_context *ctx, uint32_t current_offset) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -398,7 +398,7 @@ static void* radeon_alloc_verts( r100ContextPtr rmesa , GLuint nr, GLuint size ) /**********************************************************************/ -static GLboolean radeon_run_render( GLcontext *ctx, +static GLboolean radeon_run_render( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -467,9 +467,9 @@ static const GLuint reduced_hw_prim[GL_POLYGON+1] = { RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST }; -static void radeonRasterPrimitive( GLcontext *ctx, GLuint hwprim ); -static void radeonRenderPrimitive( GLcontext *ctx, GLenum prim ); -static void radeonResetLineStipple( GLcontext *ctx ); +static void radeonRasterPrimitive( struct gl_context *ctx, GLuint hwprim ); +static void radeonRenderPrimitive( struct gl_context *ctx, GLenum prim ); +static void radeonResetLineStipple( struct gl_context *ctx ); /*********************************************************************** @@ -678,7 +678,7 @@ static void init_rast_tab( void ) /* Choose render functions */ /**********************************************************************/ -void radeonChooseRenderState( GLcontext *ctx ) +void radeonChooseRenderState( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -718,7 +718,7 @@ void radeonChooseRenderState( GLcontext *ctx ) /**********************************************************************/ -static void radeonRasterPrimitive( GLcontext *ctx, GLuint hwprim ) +static void radeonRasterPrimitive( struct gl_context *ctx, GLuint hwprim ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -728,7 +728,7 @@ static void radeonRasterPrimitive( GLcontext *ctx, GLuint hwprim ) } } -static void radeonRenderPrimitive( GLcontext *ctx, GLenum prim ) +static void radeonRenderPrimitive( struct gl_context *ctx, GLenum prim ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); rmesa->radeon.swtcl.render_primitive = prim; @@ -736,11 +736,11 @@ static void radeonRenderPrimitive( GLcontext *ctx, GLenum prim ) radeonRasterPrimitive( ctx, reduced_hw_prim[prim] ); } -static void radeonRenderFinish( GLcontext *ctx ) +static void radeonRenderFinish( struct gl_context *ctx ) { } -static void radeonResetLineStipple( GLcontext *ctx ) +static void radeonResetLineStipple( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); RADEON_STATECHANGE( rmesa, lin ); @@ -774,7 +774,7 @@ static const char *getFallbackString(GLuint bit) } -void radeonFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) +void radeonFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -831,7 +831,7 @@ void radeonFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) /* Initialization. */ /**********************************************************************/ -void radeonInitSwtcl( GLcontext *ctx ) +void radeonInitSwtcl( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); r100ContextPtr rmesa = R100_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/radeon/radeon_swtcl.h b/src/mesa/drivers/dri/radeon/radeon_swtcl.h index da89158eeb..ce2aa1e4c3 100644 --- a/src/mesa/drivers/dri/radeon/radeon_swtcl.h +++ b/src/mesa/drivers/dri/radeon/radeon_swtcl.h @@ -39,28 +39,28 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "swrast/swrast.h" #include "radeon_context.h" -extern void radeonInitSwtcl( GLcontext *ctx ); +extern void radeonInitSwtcl( struct gl_context *ctx ); -extern void radeonChooseRenderState( GLcontext *ctx ); -extern void radeonChooseVertexState( GLcontext *ctx ); +extern void radeonChooseRenderState( struct gl_context *ctx ); +extern void radeonChooseVertexState( struct gl_context *ctx ); -extern void radeonCheckTexSizes( GLcontext *ctx ); +extern void radeonCheckTexSizes( struct gl_context *ctx ); -extern void radeonBuildVertices( GLcontext *ctx, GLuint start, GLuint count, +extern void radeonBuildVertices( struct gl_context *ctx, GLuint start, GLuint count, GLuint newinputs ); extern void radeonPrintSetupFlags(char *msg, GLuint flags ); -extern void radeon_emit_indexed_verts( GLcontext *ctx, +extern void radeon_emit_indexed_verts( struct gl_context *ctx, GLuint start, GLuint count ); -extern void radeon_translate_vertex( GLcontext *ctx, +extern void radeon_translate_vertex( struct gl_context *ctx, const radeonVertex *src, SWvertex *dst ); -extern void radeon_print_vertex( GLcontext *ctx, const radeonVertex *v ); +extern void radeon_print_vertex( struct gl_context *ctx, const radeonVertex *v ); -extern void r100_swtcl_flush(GLcontext *ctx, uint32_t current_offset); +extern void r100_swtcl_flush(struct gl_context *ctx, uint32_t current_offset); #endif diff --git a/src/mesa/drivers/dri/radeon/radeon_tcl.c b/src/mesa/drivers/dri/radeon/radeon_tcl.c index 5e1718f9df..c59b413012 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tcl.c +++ b/src/mesa/drivers/dri/radeon/radeon_tcl.c @@ -164,7 +164,7 @@ static GLushort *radeonAllocElts( r100ContextPtr rmesa, GLuint nr ) * discrete and there are no intervening state changes. (Somewhat * duplicates changes to DrawArrays code) */ -static void radeonEmitPrim( GLcontext *ctx, +static void radeonEmitPrim( struct gl_context *ctx, GLenum prim, GLuint hwprim, GLuint start, @@ -228,7 +228,7 @@ static void radeonEmitPrim( GLcontext *ctx, /* External entrypoints */ /**********************************************************************/ -void radeonEmitPrimitive( GLcontext *ctx, +void radeonEmitPrimitive( struct gl_context *ctx, GLuint first, GLuint last, GLuint flags ) @@ -236,7 +236,7 @@ void radeonEmitPrimitive( GLcontext *ctx, tcl_render_tab_verts[flags&PRIM_MODE_MASK]( ctx, first, last, flags ); } -void radeonEmitEltPrimitive( GLcontext *ctx, +void radeonEmitEltPrimitive( struct gl_context *ctx, GLuint first, GLuint last, GLuint flags ) @@ -244,7 +244,7 @@ void radeonEmitEltPrimitive( GLcontext *ctx, tcl_render_tab_elts[flags&PRIM_MODE_MASK]( ctx, first, last, flags ); } -void radeonTclPrimitive( GLcontext *ctx, +void radeonTclPrimitive( struct gl_context *ctx, GLenum prim, int hw_prim ) { @@ -326,7 +326,7 @@ radeonInitStaticFogData( void ) * Fog blend factors are in the range [0,1]. */ float -radeonComputeFogBlendFactor( GLcontext *ctx, GLfloat fogcoord ) +radeonComputeFogBlendFactor( struct gl_context *ctx, GLfloat fogcoord ) { GLfloat end = ctx->Fog.End; GLfloat d, temp; @@ -361,7 +361,7 @@ radeonComputeFogBlendFactor( GLcontext *ctx, GLfloat fogcoord ) * Predict total emit size for next rendering operation so there is no flush in middle of rendering * Prediction has to aim towards the best possible value that is worse than worst case scenario */ -static GLuint radeonEnsureEmitSize( GLcontext * ctx , GLuint inputs ) +static GLuint radeonEnsureEmitSize( struct gl_context * ctx , GLuint inputs ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -432,7 +432,7 @@ static GLuint radeonEnsureEmitSize( GLcontext * ctx , GLuint inputs ) /* TCL render. */ -static GLboolean radeon_run_tcl_render( GLcontext *ctx, +static GLboolean radeon_run_tcl_render( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -529,7 +529,7 @@ const struct tnl_pipeline_stage _radeon_tcl_stage = */ -static void transition_to_swtnl( GLcontext *ctx ) +static void transition_to_swtnl( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -558,7 +558,7 @@ static void transition_to_swtnl( GLcontext *ctx ) } -static void transition_to_hwtnl( GLcontext *ctx ) +static void transition_to_hwtnl( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -618,7 +618,7 @@ static char *getFallbackString(GLuint bit) -void radeonTclFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) +void radeonTclFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLuint oldfallback = rmesa->radeon.TclFallback; diff --git a/src/mesa/drivers/dri/radeon/radeon_tcl.h b/src/mesa/drivers/dri/radeon/radeon_tcl.h index dccbea5fdb..cf19766b9f 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tcl.h +++ b/src/mesa/drivers/dri/radeon/radeon_tcl.h @@ -38,16 +38,16 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "radeon_context.h" -extern void radeonTclPrimitive( GLcontext *ctx, GLenum prim, int hw_prim ); -extern void radeonEmitEltPrimitive( GLcontext *ctx, GLuint first, GLuint last, +extern void radeonTclPrimitive( struct gl_context *ctx, GLenum prim, int hw_prim ); +extern void radeonEmitEltPrimitive( struct gl_context *ctx, GLuint first, GLuint last, GLuint flags ); -extern void radeonEmitPrimitive( GLcontext *ctx, GLuint first, GLuint last, +extern void radeonEmitPrimitive( struct gl_context *ctx, GLuint first, GLuint last, GLuint flags ); -extern void radeonTclFallback( GLcontext *ctx, GLuint bit, GLboolean mode ); +extern void radeonTclFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ); extern void radeonInitStaticFogData( void ); -extern float radeonComputeFogBlendFactor( GLcontext *ctx, GLfloat fogcoord ); +extern float radeonComputeFogBlendFactor( struct gl_context *ctx, GLfloat fogcoord ); #define RADEON_TCL_FALLBACK_RASTER 0x1 /* rasterization */ #define RADEON_TCL_FALLBACK_UNFILLED 0x2 /* unfilled tris */ diff --git a/src/mesa/drivers/dri/radeon/radeon_tex.c b/src/mesa/drivers/dri/radeon/radeon_tex.c index c66e5d17b1..d5285e24cd 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tex.c +++ b/src/mesa/drivers/dri/radeon/radeon_tex.c @@ -253,7 +253,7 @@ static void radeonSetTexBorderColor( radeonTexObjPtr t, const GLfloat color[4] ) #define SCALED_FLOAT_TO_BYTE( x, scale ) \ (((GLuint)((255.0F / scale) * (x))) / 2) -static void radeonTexEnv( GLcontext *ctx, GLenum target, +static void radeonTexEnv( struct gl_context *ctx, GLenum target, GLenum pname, const GLfloat *param ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -316,7 +316,7 @@ static void radeonTexEnv( GLcontext *ctx, GLenum target, * next UpdateTextureState */ -static void radeonTexParameter( GLcontext *ctx, GLenum target, +static void radeonTexParameter( struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj, GLenum pname, const GLfloat *params ) { @@ -354,7 +354,7 @@ static void radeonTexParameter( GLcontext *ctx, GLenum target, } } -static void radeonDeleteTexture( GLcontext *ctx, +static void radeonDeleteTexture( struct gl_context *ctx, struct gl_texture_object *texObj ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -392,7 +392,7 @@ static void radeonDeleteTexture( GLcontext *ctx, * Basically impossible to do this on the fly - just collect some * basic info & do the checks from ValidateState(). */ -static void radeonTexGen( GLcontext *ctx, +static void radeonTexGen( struct gl_context *ctx, GLenum coord, GLenum pname, const GLfloat *params ) @@ -409,7 +409,7 @@ static void radeonTexGen( GLcontext *ctx, * texture object from the core mesa gl_texture_object. Not done at this time. */ static struct gl_texture_object * -radeonNewTextureObject( GLcontext *ctx, GLuint name, GLenum target ) +radeonNewTextureObject( struct gl_context *ctx, GLuint name, GLenum target ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); radeonTexObj* t = CALLOC_STRUCT(radeon_tex_obj); diff --git a/src/mesa/drivers/dri/radeon/radeon_tex.h b/src/mesa/drivers/dri/radeon/radeon_tex.h index 0113ffd3da..05729f1e0b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tex.h +++ b/src/mesa/drivers/dri/radeon/radeon_tex.h @@ -45,7 +45,7 @@ extern void radeonSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawabl extern void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_format, __DRIdrawable *dPriv); -extern void radeonUpdateTextureState( GLcontext *ctx ); +extern void radeonUpdateTextureState( struct gl_context *ctx ); extern int radeonUploadTexImages( r100ContextPtr rmesa, radeonTexObjPtr t, GLuint face ); diff --git a/src/mesa/drivers/dri/radeon/radeon_tex_copy.c b/src/mesa/drivers/dri/radeon/radeon_tex_copy.c index 4cb0bb60c8..f14dfa25d4 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tex_copy.c +++ b/src/mesa/drivers/dri/radeon/radeon_tex_copy.c @@ -37,7 +37,7 @@ #include "radeon_mipmap_tree.h" static GLboolean -do_copy_texsubimage(GLcontext *ctx, +do_copy_texsubimage(struct gl_context *ctx, GLenum target, GLint level, struct radeon_tex_obj *tobj, radeon_texture_image *timg, @@ -141,7 +141,7 @@ do_copy_texsubimage(GLcontext *ctx, } void -radeonCopyTexImage2D(GLcontext *ctx, GLenum target, GLint level, +radeonCopyTexImage2D(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) @@ -196,7 +196,7 @@ fail: } void -radeonCopyTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, +radeonCopyTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) diff --git a/src/mesa/drivers/dri/radeon/radeon_tex_getimage.c b/src/mesa/drivers/dri/radeon/radeon_tex_getimage.c index f878b48e5f..4a73089ce1 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tex_getimage.c +++ b/src/mesa/drivers/dri/radeon/radeon_tex_getimage.c @@ -40,7 +40,7 @@ * then unmap it. */ static void -radeon_get_tex_image(GLcontext * ctx, GLenum target, GLint level, +radeon_get_tex_image(struct gl_context * ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels, struct gl_texture_object *texObj, struct gl_texture_image *texImage, int compressed) @@ -83,7 +83,7 @@ radeon_get_tex_image(GLcontext * ctx, GLenum target, GLint level, } void -radeonGetTexImage(GLcontext * ctx, GLenum target, GLint level, +radeonGetTexImage(struct gl_context * ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels, struct gl_texture_object *texObj, struct gl_texture_image *texImage) @@ -93,7 +93,7 @@ radeonGetTexImage(GLcontext * ctx, GLenum target, GLint level, } void -radeonGetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level, +radeonGetCompressedTexImage(struct gl_context *ctx, GLenum target, GLint level, GLvoid *pixels, struct gl_texture_object *texObj, struct gl_texture_image *texImage) diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c index f852116dee..dd8ecdd500 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c @@ -260,7 +260,7 @@ do { \ * Texture unit state management */ -static GLboolean radeonUpdateTextureEnv( GLcontext *ctx, int unit ) +static GLboolean radeonUpdateTextureEnv( struct gl_context *ctx, int unit ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; @@ -885,7 +885,7 @@ static void set_texgen_matrix( r100ContextPtr rmesa, /* Returns GL_FALSE if fallback required. */ -static GLboolean radeon_validate_texgen( GLcontext *ctx, GLuint unit ) +static GLboolean radeon_validate_texgen( struct gl_context *ctx, GLuint unit ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; @@ -1085,7 +1085,7 @@ static GLboolean setup_hardware_state(r100ContextPtr rmesa, radeonTexObj *t, int return GL_TRUE; } -static GLboolean radeon_validate_texture(GLcontext *ctx, struct gl_texture_object *texObj, int unit) +static GLboolean radeon_validate_texture(struct gl_context *ctx, struct gl_texture_object *texObj, int unit) { r100ContextPtr rmesa = R100_CONTEXT(ctx); radeonTexObj *t = radeon_tex_obj(texObj); @@ -1128,7 +1128,7 @@ static GLboolean radeon_validate_texture(GLcontext *ctx, struct gl_texture_objec return !t->border_fallback; } -static GLboolean radeonUpdateTextureUnit( GLcontext *ctx, int unit ) +static GLboolean radeonUpdateTextureUnit( struct gl_context *ctx, int unit ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); @@ -1155,7 +1155,7 @@ static GLboolean radeonUpdateTextureUnit( GLcontext *ctx, int unit ) return GL_TRUE; } -void radeonUpdateTextureState( GLcontext *ctx ) +void radeonUpdateTextureState( struct gl_context *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); GLboolean ok; diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 8c6a50d2f0..18ccb512d7 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -32,7 +32,6 @@ #include "main/glheader.h" #include "main/imports.h" #include "main/context.h" -#include "main/convolve.h" #include "main/enums.h" #include "main/mipmap.h" #include "main/texcompress.h" @@ -77,7 +76,7 @@ void copy_rows(void* dst, GLuint dststride, const void* src, GLuint srcstride, /** * Allocate an empty texture image object. */ -struct gl_texture_image *radeonNewTextureImage(GLcontext *ctx) +struct gl_texture_image *radeonNewTextureImage(struct gl_context *ctx) { return CALLOC(sizeof(radeon_texture_image)); } @@ -85,7 +84,7 @@ struct gl_texture_image *radeonNewTextureImage(GLcontext *ctx) /** * Free memory associated with this texture image. */ -void radeonFreeTexImageData(GLcontext *ctx, struct gl_texture_image *timage) +void radeonFreeTexImageData(struct gl_context *ctx, struct gl_texture_image *timage) { radeon_texture_image* image = get_radeon_texture_image(timage); @@ -155,7 +154,7 @@ void radeon_teximage_unmap(radeon_texture_image *image) } } -static void map_override(GLcontext *ctx, radeonTexObj *t) +static void map_override(struct gl_context *ctx, radeonTexObj *t) { radeon_texture_image *img = get_radeon_texture_image(t->base.Image[0][0]); @@ -164,7 +163,7 @@ static void map_override(GLcontext *ctx, radeonTexObj *t) img->base.Data = t->bo->ptr; } -static void unmap_override(GLcontext *ctx, radeonTexObj *t) +static void unmap_override(struct gl_context *ctx, radeonTexObj *t) { radeon_texture_image *img = get_radeon_texture_image(t->base.Image[0][0]); @@ -176,7 +175,7 @@ static void unmap_override(GLcontext *ctx, radeonTexObj *t) /** * Map a validated texture for reading during software rendering. */ -void radeonMapTexture(GLcontext *ctx, struct gl_texture_object *texObj) +void radeonMapTexture(struct gl_context *ctx, struct gl_texture_object *texObj) { radeonTexObj* t = radeon_tex_obj(texObj); int face, level; @@ -214,7 +213,7 @@ void radeonMapTexture(GLcontext *ctx, struct gl_texture_object *texObj) } } -void radeonUnmapTexture(GLcontext *ctx, struct gl_texture_object *texObj) +void radeonUnmapTexture(struct gl_context *ctx, struct gl_texture_object *texObj) { radeonTexObj* t = radeon_tex_obj(texObj); int face, level; @@ -242,7 +241,7 @@ void radeonUnmapTexture(GLcontext *ctx, struct gl_texture_object *texObj) * This relies on internal details of _mesa_generate_mipmap, in particular * the fact that the memory for recreated texture images is always freed. */ -static void radeon_generate_mipmap(GLcontext *ctx, GLenum target, +static void radeon_generate_mipmap(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj) { radeonTexObj* t = radeon_tex_obj(texObj); @@ -274,7 +273,7 @@ static void radeon_generate_mipmap(GLcontext *ctx, GLenum target, } -void radeonGenerateMipmap(GLcontext* ctx, GLenum target, struct gl_texture_object *texObj) +void radeonGenerateMipmap(struct gl_context* ctx, GLenum target, struct gl_texture_object *texObj) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); struct radeon_bo *bo; @@ -339,7 +338,7 @@ static gl_format radeonChoose8888TexFormat(radeonContextPtr rmesa, return _dri_texformat_argb8888; } -gl_format radeonChooseTextureFormat_mesa(GLcontext * ctx, +gl_format radeonChooseTextureFormat_mesa(struct gl_context * ctx, GLint internalFormat, GLenum format, GLenum type) @@ -348,7 +347,7 @@ gl_format radeonChooseTextureFormat_mesa(GLcontext * ctx, type, 0); } -gl_format radeonChooseTextureFormat(GLcontext * ctx, +gl_format radeonChooseTextureFormat(struct gl_context * ctx, GLint internalFormat, GLenum format, GLenum type, GLboolean fbo) @@ -642,7 +641,7 @@ static void teximage_assign_miptree(radeonContextPtr rmesa, "%s Failed to allocate miptree.\n", __func__); } -static GLuint * allocate_image_offsets(GLcontext *ctx, +static GLuint * allocate_image_offsets(struct gl_context *ctx, unsigned alignedWidth, unsigned height, unsigned depth) @@ -666,7 +665,7 @@ static GLuint * allocate_image_offsets(GLcontext *ctx, /** * Update a subregion of the given texture image. */ -static void radeon_store_teximage(GLcontext* ctx, int dims, +static void radeon_store_teximage(struct gl_context* ctx, int dims, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, @@ -759,7 +758,7 @@ static void radeon_store_teximage(GLcontext* ctx, int dims, * All glTexImage calls go through this function. */ static void radeon_teximage( - GLcontext *ctx, int dims, + struct gl_context *ctx, int dims, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint depth, @@ -773,8 +772,6 @@ static void radeon_teximage( radeonContextPtr rmesa = RADEON_CONTEXT(ctx); radeonTexObj* t = radeon_tex_obj(texObj); radeon_texture_image* image = get_radeon_texture_image(texImage); - GLint postConvWidth = width; - GLint postConvHeight = height; GLuint face = _mesa_tex_target_to_face(target); radeon_print(RADEON_TEXTURE, RADEON_NORMAL, @@ -795,23 +792,6 @@ static void radeon_teximage( t->validated = GL_FALSE; - if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) { - _mesa_adjust_image_for_convolution(ctx, dims, &postConvWidth, - &postConvHeight); - } - - if (!_mesa_is_format_compressed(texImage->TexFormat)) { - GLuint texelBytes = _mesa_get_format_bytes(texImage->TexFormat); - /* Minimum pitch of 32 bytes */ - if (postConvWidth * texelBytes < 32) { - postConvWidth = 32 / texelBytes; - texImage->RowStride = postConvWidth; - } - if (!image->mt) { - assert(texImage->RowStride == postConvWidth); - } - } - /* Mesa core only clears texImage->Data but not image->mt */ radeonFreeTexImageData(ctx, texImage); @@ -853,7 +833,7 @@ static void radeon_teximage( _mesa_unmap_teximage_pbo(ctx, packing); } -void radeonTexImage1D(GLcontext * ctx, GLenum target, GLint level, +void radeonTexImage1D(struct gl_context * ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid * pixels, @@ -865,7 +845,7 @@ void radeonTexImage1D(GLcontext * ctx, GLenum target, GLint level, 0, format, type, pixels, packing, texObj, texImage, 0); } -void radeonTexImage2D(GLcontext * ctx, GLenum target, GLint level, +void radeonTexImage2D(struct gl_context * ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid * pixels, @@ -878,7 +858,7 @@ void radeonTexImage2D(GLcontext * ctx, GLenum target, GLint level, 0, format, type, pixels, packing, texObj, texImage, 0); } -void radeonCompressedTexImage2D(GLcontext * ctx, GLenum target, +void radeonCompressedTexImage2D(struct gl_context * ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLsizei imageSize, const GLvoid * data, @@ -889,7 +869,7 @@ void radeonCompressedTexImage2D(GLcontext * ctx, GLenum target, imageSize, 0, 0, data, &ctx->Unpack, texObj, texImage, 1); } -void radeonTexImage3D(GLcontext * ctx, GLenum target, GLint level, +void radeonTexImage3D(struct gl_context * ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint depth, GLint border, @@ -905,7 +885,7 @@ void radeonTexImage3D(GLcontext * ctx, GLenum target, GLint level, /** * All glTexSubImage calls go through this function. */ -static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int level, +static void radeon_texsubimage(struct gl_context* ctx, int dims, GLenum target, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, @@ -959,7 +939,7 @@ static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int leve _mesa_unmap_teximage_pbo(ctx, packing); } -void radeonTexSubImage1D(GLcontext * ctx, GLenum target, GLint level, +void radeonTexSubImage1D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, @@ -972,7 +952,7 @@ void radeonTexSubImage1D(GLcontext * ctx, GLenum target, GLint level, format, type, pixels, packing, texObj, texImage, 0); } -void radeonTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, +void radeonTexSubImage2D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -986,7 +966,7 @@ void radeonTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, 0); } -void radeonCompressedTexSubImage2D(GLcontext * ctx, GLenum target, +void radeonCompressedTexSubImage2D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, @@ -999,7 +979,7 @@ void radeonCompressedTexSubImage2D(GLcontext * ctx, GLenum target, } -void radeonTexSubImage3D(GLcontext * ctx, GLenum target, GLint level, +void radeonTexSubImage3D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.h b/src/mesa/drivers/dri/radeon/radeon_texture.h index 4ce639ea34..9138a7d554 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.h +++ b/src/mesa/drivers/dri/radeon/radeon_texture.h @@ -35,47 +35,47 @@ void copy_rows(void* dst, GLuint dststride, const void* src, GLuint srcstride, GLuint numrows, GLuint rowsize); -struct gl_texture_image *radeonNewTextureImage(GLcontext *ctx); -void radeonFreeTexImageData(GLcontext *ctx, struct gl_texture_image *timage); +struct gl_texture_image *radeonNewTextureImage(struct gl_context *ctx); +void radeonFreeTexImageData(struct gl_context *ctx, struct gl_texture_image *timage); void radeon_teximage_map(radeon_texture_image *image, GLboolean write_enable); void radeon_teximage_unmap(radeon_texture_image *image); -void radeonMapTexture(GLcontext *ctx, struct gl_texture_object *texObj); -void radeonUnmapTexture(GLcontext *ctx, struct gl_texture_object *texObj); -void radeonGenerateMipmap(GLcontext* ctx, GLenum target, struct gl_texture_object *texObj); -int radeon_validate_texture_miptree(GLcontext * ctx, struct gl_texture_object *texObj); +void radeonMapTexture(struct gl_context *ctx, struct gl_texture_object *texObj); +void radeonUnmapTexture(struct gl_context *ctx, struct gl_texture_object *texObj); +void radeonGenerateMipmap(struct gl_context* ctx, GLenum target, struct gl_texture_object *texObj); +int radeon_validate_texture_miptree(struct gl_context * ctx, struct gl_texture_object *texObj); -gl_format radeonChooseTextureFormat_mesa(GLcontext * ctx, +gl_format radeonChooseTextureFormat_mesa(struct gl_context * ctx, GLint internalFormat, GLenum format, GLenum type); -gl_format radeonChooseTextureFormat(GLcontext * ctx, +gl_format radeonChooseTextureFormat(struct gl_context * ctx, GLint internalFormat, GLenum format, GLenum type, GLboolean fbo); -void radeonTexImage1D(GLcontext * ctx, GLenum target, GLint level, +void radeonTexImage1D(struct gl_context * ctx, GLenum target, GLint level, GLint internalFormat, GLint width, 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); -void radeonTexImage2D(GLcontext * ctx, GLenum target, GLint level, +void radeonTexImage2D(struct gl_context * 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); -void radeonCompressedTexImage2D(GLcontext * ctx, GLenum target, +void radeonCompressedTexImage2D(struct gl_context * ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLsizei imageSize, const GLvoid * data, struct gl_texture_object *texObj, struct gl_texture_image *texImage); -void radeonTexImage3D(GLcontext * ctx, GLenum target, GLint level, +void radeonTexImage3D(struct gl_context * ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint depth, GLint border, @@ -83,7 +83,7 @@ void radeonTexImage3D(GLcontext * ctx, GLenum target, GLint level, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); -void radeonTexSubImage1D(GLcontext * ctx, GLenum target, GLint level, +void radeonTexSubImage1D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, @@ -91,7 +91,7 @@ void radeonTexSubImage1D(GLcontext * ctx, GLenum target, GLint level, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); -void radeonTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, +void radeonTexSubImage2D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -99,7 +99,7 @@ void radeonTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); -void radeonCompressedTexSubImage2D(GLcontext * ctx, GLenum target, +void radeonCompressedTexSubImage2D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, @@ -107,7 +107,7 @@ void radeonCompressedTexSubImage2D(GLcontext * ctx, GLenum target, struct gl_texture_object *texObj, struct gl_texture_image *texImage); -void radeonTexSubImage3D(GLcontext * ctx, GLenum target, GLint level, +void radeonTexSubImage3D(struct gl_context * ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, @@ -116,21 +116,21 @@ void radeonTexSubImage3D(GLcontext * ctx, GLenum target, GLint level, struct gl_texture_object *texObj, struct gl_texture_image *texImage); -void radeonGetTexImage(GLcontext * ctx, GLenum target, GLint level, +void radeonGetTexImage(struct gl_context * ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels, struct gl_texture_object *texObj, struct gl_texture_image *texImage); -void radeonGetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level, +void radeonGetCompressedTexImage(struct gl_context *ctx, GLenum target, GLint level, GLvoid *pixels, struct gl_texture_object *texObj, struct gl_texture_image *texImage); -void radeonCopyTexImage2D(GLcontext *ctx, GLenum target, GLint level, +void radeonCopyTexImage2D(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -void radeonCopyTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, +void radeonCopyTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index cbdc9c87ee..b3aaa0e504 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -26,8 +26,6 @@ #include <stdio.h> #include "main/context.h" -#include "main/context.h" -#include "main/matrix.h" #include "main/framebuffer.h" #include "main/renderbuffer.h" #include "main/simple_list.h" @@ -289,11 +287,11 @@ savageDestroyScreen(__DRIscreen *sPriv) static GLboolean savageCreateContext( gl_api api, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, __DRIcontext *driContextPriv, void *sharedContextPrivate ) { - GLcontext *ctx, *shareCtx; + struct gl_context *ctx, *shareCtx; savageContextPtr imesa; __DRIscreen *sPriv = driContextPriv->driScreenPriv; struct dd_function_table functions; @@ -588,7 +586,7 @@ savageDestroyContext(__DRIcontext *driContextPriv) static GLboolean savageCreateBuffer( __DRIscreen *driScrnPriv, __DRIdrawable *driDrawPriv, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, GLboolean isPixmap) { savageScreenPrivate *screen = (savageScreenPrivate *) driScrnPriv->private; @@ -683,7 +681,7 @@ savageCreateBuffer( __DRIscreen *driScrnPriv, static void savageDestroyBuffer(__DRIdrawable *driDrawPriv) { - _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL); + _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL); } #if 0 @@ -791,9 +789,9 @@ savageMakeCurrent(__DRIcontext *driContextPriv, savageContextPtr imesa = (savageContextPtr) driContextPriv->driverPrivate; struct gl_framebuffer *drawBuffer - = (GLframebuffer *) driDrawPriv->driverPrivate; + = (struct gl_framebuffer *) driDrawPriv->driverPrivate; struct gl_framebuffer *readBuffer - = (GLframebuffer *) driReadPriv->driverPrivate; + = (struct gl_framebuffer *) driReadPriv->driverPrivate; driRenderbuffer *frontRb = (driRenderbuffer *) drawBuffer->Attachment[BUFFER_FRONT_LEFT].Renderbuffer; driRenderbuffer *backRb = (driRenderbuffer *) @@ -894,7 +892,7 @@ savageFillInModes( __DRIscreen *psp, unsigned stencil_bits, GLboolean have_back_buffer ) { __DRIconfig **configs; - __GLcontextModes * m; + struct gl_config * m; unsigned depth_buffer_factor; unsigned back_buffer_factor; GLenum fb_format; @@ -970,7 +968,7 @@ savageFillInModes( __DRIscreen *psp, * * \todo maybe fold this into intelInitDriver * - * \return the __GLcontextModes supported by this driver + * \return the struct gl_config supported by this driver */ static const __DRIconfig ** savageInitScreen(__DRIscreen *psp) diff --git a/src/mesa/drivers/dri/savage/savagecontext.h b/src/mesa/drivers/dri/savage/savagecontext.h index ba1e6e1e1a..75bec62fa8 100644 --- a/src/mesa/drivers/dri/savage/savagecontext.h +++ b/src/mesa/drivers/dri/savage/savagecontext.h @@ -148,7 +148,7 @@ struct savage_elt_t { struct savage_context_t { GLint refcount; - GLcontext *glCtx; + struct gl_context *glCtx; int lastTexHeap; driTexHeap *textureHeaps[SAVAGE_NR_TEX_HEAPS]; @@ -226,7 +226,7 @@ struct savage_context_t { /* DRI stuff */ GLuint bufferSize; - GLframebuffer *glBuffer; + struct gl_framebuffer *glBuffer; /* Two flags to keep track of fallbacks. */ GLuint Fallback; diff --git a/src/mesa/drivers/dri/savage/savagedd.c b/src/mesa/drivers/dri/savage/savagedd.c index bbf49aec27..3f8d7aafb0 100644 --- a/src/mesa/drivers/dri/savage/savagedd.c +++ b/src/mesa/drivers/dri/savage/savagedd.c @@ -45,7 +45,7 @@ ***************************************/ -static const GLubyte *savageDDGetString( GLcontext *ctx, GLenum name ) +static const GLubyte *savageDDGetString( struct gl_context *ctx, GLenum name ) { static char *cardNames[S3_LAST] = { "Unknown", @@ -79,7 +79,7 @@ static const GLubyte *savageDDGetString( GLcontext *ctx, GLenum name ) } } #if 0 -static GLint savageGetParameteri(const GLcontext *ctx, GLint param) +static GLint savageGetParameteri(const struct gl_context *ctx, GLint param) { switch (param) { case DD_HAVE_HARDWARE_FOG: @@ -91,7 +91,7 @@ static GLint savageGetParameteri(const GLcontext *ctx, GLint param) #endif -void savageDDInitDriverFuncs( GLcontext *ctx ) +void savageDDInitDriverFuncs( struct gl_context *ctx ) { ctx->Driver.GetString = savageDDGetString; } diff --git a/src/mesa/drivers/dri/savage/savagedd.h b/src/mesa/drivers/dri/savage/savagedd.h index 698a8d5de9..c526141299 100644 --- a/src/mesa/drivers/dri/savage/savagedd.h +++ b/src/mesa/drivers/dri/savage/savagedd.h @@ -28,5 +28,5 @@ #include "main/context.h" -void savageDDInitDriverFuncs( GLcontext *ctx ); +void savageDDInitDriverFuncs( struct gl_context *ctx ); #endif diff --git a/src/mesa/drivers/dri/savage/savageioctl.c b/src/mesa/drivers/dri/savage/savageioctl.c index 9e181ce3be..46bbb653b8 100644 --- a/src/mesa/drivers/dri/savage/savageioctl.c +++ b/src/mesa/drivers/dri/savage/savageioctl.c @@ -119,7 +119,7 @@ void savageGetDMABuffer( savageContextPtr imesa ) #if 0 /* Still keeping this around because it demonstrates page flipping and * automatic z-clear. */ -static void savage_BCI_clear(GLcontext *ctx, drm_savage_clear_t *pclear) +static void savage_BCI_clear(struct gl_context *ctx, drm_savage_clear_t *pclear) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); int nbox = imesa->sarea->nbox; @@ -325,7 +325,7 @@ static GLuint savageIntersectClipRects(drm_clip_rect_t *dest, } -static void savageDDClear( GLcontext *ctx, GLbitfield mask ) +static void savageDDClear( struct gl_context *ctx, GLbitfield mask ) { savageContextPtr imesa = SAVAGE_CONTEXT( ctx ); GLuint colorMask, depthMask, clearColor, clearDepth, flags; @@ -635,7 +635,7 @@ void savageFlushCmdBuf( savageContextPtr imesa, GLboolean discard ) } -static void savageDDFlush( GLcontext *ctx ) +static void savageDDFlush( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG) @@ -644,7 +644,7 @@ static void savageDDFlush( GLcontext *ctx ) savageFlushCmdBuf(imesa, GL_FALSE); } -static void savageDDFinish( GLcontext *ctx ) +static void savageDDFinish( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG) @@ -654,7 +654,7 @@ static void savageDDFinish( GLcontext *ctx ) WAIT_IDLE_EMPTY(imesa); } -void savageDDInitIoctlFuncs( GLcontext *ctx ) +void savageDDInitIoctlFuncs( struct gl_context *ctx ) { ctx->Driver.Clear = savageDDClear; ctx->Driver.Flush = savageDDFlush; diff --git a/src/mesa/drivers/dri/savage/savageioctl.h b/src/mesa/drivers/dri/savage/savageioctl.h index e7e80816c1..7d34825c29 100644 --- a/src/mesa/drivers/dri/savage/savageioctl.h +++ b/src/mesa/drivers/dri/savage/savageioctl.h @@ -37,7 +37,7 @@ void savageWaitEvent( savageContextPtr imesa, unsigned int event); void savageFlushCmdBufLocked( savageContextPtr imesa, GLboolean discard ); void savageFlushCmdBuf( savageContextPtr imesa, GLboolean discard ); -void savageDDInitIoctlFuncs( GLcontext *ctx ); +void savageDDInitIoctlFuncs( struct gl_context *ctx ); void savageSwapBuffers( __DRIdrawable *dPriv ); diff --git a/src/mesa/drivers/dri/savage/savagerender.c b/src/mesa/drivers/dri/savage/savagerender.c index 2d9e80e29c..8cc448ad4f 100644 --- a/src/mesa/drivers/dri/savage/savagerender.c +++ b/src/mesa/drivers/dri/savage/savagerender.c @@ -142,7 +142,7 @@ /* Render pipeline stage */ /**********************************************************************/ -static GLboolean savage_run_render( GLcontext *ctx, +static GLboolean savage_run_render( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -234,7 +234,7 @@ struct texnorm_stage_data { #define TEXNORM_STAGE_DATA(stage) ((struct texnorm_stage_data *)stage->privatePtr) -static GLboolean run_texnorm_stage( GLcontext *ctx, +static GLboolean run_texnorm_stage( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { struct texnorm_stage_data *store = TEXNORM_STAGE_DATA(stage); @@ -307,7 +307,7 @@ static GLboolean run_texnorm_stage( GLcontext *ctx, /* Called the first time stage->run() is invoked. */ -static GLboolean alloc_texnorm_data( GLcontext *ctx, +static GLboolean alloc_texnorm_data( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; @@ -325,7 +325,7 @@ static GLboolean alloc_texnorm_data( GLcontext *ctx, return GL_TRUE; } -static void validate_texnorm( GLcontext *ctx, +static void validate_texnorm( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { struct texnorm_stage_data *store = TEXNORM_STAGE_DATA(stage); diff --git a/src/mesa/drivers/dri/savage/savagespan.c b/src/mesa/drivers/dri/savage/savagespan.c index 0913dd1278..8542f47fd9 100644 --- a/src/mesa/drivers/dri/savage/savagespan.c +++ b/src/mesa/drivers/dri/savage/savagespan.c @@ -187,7 +187,7 @@ * the frame buffer. */ static void -savageCopyPixels( GLcontext *ctx, +savageCopyPixels( struct gl_context *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint destx, GLint desty, GLenum type ) @@ -198,7 +198,7 @@ savageCopyPixels( GLcontext *ctx, _swrast_CopyPixels(ctx, srcx, srcy, width, height, destx, desty, type); } static void -savageDrawPixels( GLcontext *ctx, +savageDrawPixels( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -211,7 +211,7 @@ savageDrawPixels( GLcontext *ctx, _swrast_DrawPixels(ctx, x, y, width, height, format, type, packing, pixels); } static void -savageReadPixels( GLcontext *ctx, +savageReadPixels( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *packing, @@ -226,7 +226,7 @@ savageReadPixels( GLcontext *ctx, /* * Make sure the hardware is idle when span-rendering. */ -static void savageSpanRenderStart( GLcontext *ctx ) +static void savageSpanRenderStart( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); FLUSH_BATCH(imesa); @@ -234,7 +234,7 @@ static void savageSpanRenderStart( GLcontext *ctx ) } -void savageDDInitSpanFuncs( GLcontext *ctx ) +void savageDDInitSpanFuncs( struct gl_context *ctx ) { struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx); swdd->SpanRenderStart = savageSpanRenderStart; @@ -251,7 +251,7 @@ void savageDDInitSpanFuncs( GLcontext *ctx ) * Plug in the Get/Put routines for the given driRenderbuffer. */ void -savageSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis, +savageSetSpanFunctions(driRenderbuffer *drb, const struct gl_config *vis, GLboolean float_depth) { if (drb->Base.Format == MESA_FORMAT_RGB565) { diff --git a/src/mesa/drivers/dri/savage/savagespan.h b/src/mesa/drivers/dri/savage/savagespan.h index 53a7f8b97c..41d6f75cbb 100644 --- a/src/mesa/drivers/dri/savage/savagespan.h +++ b/src/mesa/drivers/dri/savage/savagespan.h @@ -28,10 +28,10 @@ #include "drirenderbuffer.h" -extern void savageDDInitSpanFuncs( GLcontext *ctx ); +extern void savageDDInitSpanFuncs( struct gl_context *ctx ); extern void -savageSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis, +savageSetSpanFunctions(driRenderbuffer *rb, const struct gl_config *vis, GLboolean float_depth); diff --git a/src/mesa/drivers/dri/savage/savagestate.c b/src/mesa/drivers/dri/savage/savagestate.c index 84e1b52585..0906f85b1f 100644 --- a/src/mesa/drivers/dri/savage/savagestate.c +++ b/src/mesa/drivers/dri/savage/savagestate.c @@ -73,8 +73,8 @@ #define S3D_TR 15 -static void savageBlendFunc_s4(GLcontext *); -static void savageBlendFunc_s3d(GLcontext *); +static void savageBlendFunc_s4(struct gl_context *); +static void savageBlendFunc_s3d(struct gl_context *); static INLINE GLuint savagePackColor(GLuint format, GLubyte r, GLubyte g, @@ -92,16 +92,16 @@ static INLINE GLuint savagePackColor(GLuint format, } -static void savageDDAlphaFunc_s4(GLcontext *ctx, GLenum func, GLfloat ref) +static void savageDDAlphaFunc_s4(struct gl_context *ctx, GLenum func, GLfloat ref) { savageBlendFunc_s4(ctx); } -static void savageDDAlphaFunc_s3d(GLcontext *ctx, GLenum func, GLfloat ref) +static void savageDDAlphaFunc_s3d(struct gl_context *ctx, GLenum func, GLfloat ref) { savageBlendFunc_s3d(ctx); } -static void savageDDBlendEquationSeparate(GLcontext *ctx, +static void savageDDBlendEquationSeparate(struct gl_context *ctx, GLenum modeRGB, GLenum modeA) { assert( modeRGB == modeA ); @@ -119,7 +119,7 @@ static void savageDDBlendEquationSeparate(GLcontext *ctx, } -static void savageBlendFunc_s4(GLcontext *ctx) +static void savageBlendFunc_s4(struct gl_context *ctx) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); uint32_t drawLocalCtrl = imesa->regs.s4.drawLocalCtrl.ui; @@ -294,7 +294,7 @@ static void savageBlendFunc_s4(GLcontext *ctx) drawCtrl1 != imesa->regs.s4.drawCtrl1.ui) imesa->dirty |= SAVAGE_UPLOAD_GLOBAL; } -static void savageBlendFunc_s3d(GLcontext *ctx) +static void savageBlendFunc_s3d(struct gl_context *ctx) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); uint32_t drawCtrl = imesa->regs.s3d.drawCtrl.ui; @@ -465,14 +465,14 @@ static void savageBlendFunc_s3d(GLcontext *ctx) imesa->dirty |= SAVAGE_UPLOAD_LOCAL; } -static void savageDDBlendFuncSeparate_s4( GLcontext *ctx, GLenum sfactorRGB, +static void savageDDBlendFuncSeparate_s4( struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) { assert (dfactorRGB == dfactorA && sfactorRGB == sfactorA); savageBlendFunc_s4( ctx ); } -static void savageDDBlendFuncSeparate_s3d( GLcontext *ctx, GLenum sfactorRGB, +static void savageDDBlendFuncSeparate_s3d( struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) { @@ -482,7 +482,7 @@ static void savageDDBlendFuncSeparate_s3d( GLcontext *ctx, GLenum sfactorRGB, -static void savageDDDepthFunc_s4(GLcontext *ctx, GLenum func) +static void savageDDDepthFunc_s4(struct gl_context *ctx, GLenum func) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); ZCmpFunc zmode; @@ -546,7 +546,7 @@ static void savageDDDepthFunc_s4(GLcontext *ctx, GLenum func) zWatermarks != imesa->regs.s4.zWatermarks.ui) imesa->dirty |= SAVAGE_UPLOAD_GLOBAL; } -static void savageDDDepthFunc_s3d(GLcontext *ctx, GLenum func) +static void savageDDDepthFunc_s3d(struct gl_context *ctx, GLenum func) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); ZCmpFunc zmode; @@ -600,11 +600,11 @@ static void savageDDDepthFunc_s3d(GLcontext *ctx, GLenum func) imesa->dirty |= SAVAGE_UPLOAD_GLOBAL; } -static void savageDDDepthMask_s4(GLcontext *ctx, GLboolean flag) +static void savageDDDepthMask_s4(struct gl_context *ctx, GLboolean flag) { savageDDDepthFunc_s4(ctx,ctx->Depth.Func); } -static void savageDDDepthMask_s3d(GLcontext *ctx, GLboolean flag) +static void savageDDDepthMask_s3d(struct gl_context *ctx, GLboolean flag) { savageDDDepthFunc_s3d(ctx,ctx->Depth.Func); } @@ -617,7 +617,7 @@ static void savageDDDepthMask_s3d(GLcontext *ctx, GLboolean flag) */ -static void savageDDScissor( GLcontext *ctx, GLint x, GLint y, +static void savageDDScissor( struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -635,7 +635,7 @@ static void savageDDScissor( GLcontext *ctx, GLint x, GLint y, -static void savageDDDrawBuffer(GLcontext *ctx, GLenum mode ) +static void savageDDDrawBuffer(struct gl_context *ctx, GLenum mode ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); uint32_t destCtrl = imesa->regs.s4.destCtrl.ui; @@ -667,13 +667,13 @@ static void savageDDDrawBuffer(GLcontext *ctx, GLenum mode ) imesa->dirty |= SAVAGE_UPLOAD_GLOBAL; } -static void savageDDReadBuffer(GLcontext *ctx, GLenum mode ) +static void savageDDReadBuffer(struct gl_context *ctx, GLenum mode ) { /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */ } #if 0 -static void savageDDSetColor(GLcontext *ctx, +static void savageDDSetColor(struct gl_context *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a ) { @@ -686,7 +686,7 @@ static void savageDDSetColor(GLcontext *ctx, * Window position and viewport transformation */ -void savageCalcViewport( GLcontext *ctx ) +void savageCalcViewport( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); const GLfloat *v = ctx->Viewport._WindowMap.m; @@ -712,14 +712,14 @@ void savageCalcViewport( GLcontext *ctx ) imesa->SetupNewInputs = ~0; } -static void savageViewport( GLcontext *ctx, +static void savageViewport( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) { savageCalcViewport( ctx ); } -static void savageDepthRange( GLcontext *ctx, +static void savageDepthRange( struct gl_context *ctx, GLclampd nearval, GLclampd farval ) { savageCalcViewport( ctx ); @@ -730,7 +730,7 @@ static void savageDepthRange( GLcontext *ctx, * Miscellaneous */ -static void savageDDClearColor(GLcontext *ctx, +static void savageDDClearColor(struct gl_context *ctx, const GLfloat color[4] ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -746,7 +746,7 @@ static void savageDDClearColor(GLcontext *ctx, /* Fallback to swrast for select and feedback. */ -static void savageRenderMode( GLcontext *ctx, GLenum mode ) +static void savageRenderMode( struct gl_context *ctx, GLenum mode ) { FALLBACK( ctx, SAVAGE_FALLBACK_RENDERMODE, (mode != GL_RENDER) ); } @@ -758,7 +758,7 @@ static void savageRenderMode( GLcontext *ctx, GLenum mode ) * Culling - the savage isn't quite as clean here as the rest of * its interfaces, but it's not bad. */ -static void savageDDCullFaceFrontFace(GLcontext *ctx, GLenum unused) +static void savageDDCullFaceFrontFace(struct gl_context *ctx, GLenum unused) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); GLuint cullMode=imesa->LcsCullMode; @@ -793,7 +793,7 @@ static void savageDDCullFaceFrontFace(GLcontext *ctx, GLenum unused) } #endif /* end #if HW_CULL */ -static void savageUpdateCull( GLcontext *ctx ) +static void savageUpdateCull( struct gl_context *ctx ) { #if HW_CULL savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -829,7 +829,7 @@ static void savageUpdateCull( GLcontext *ctx ) * to have any effect. If only some channels are masked we need a * software fallback on all chips. */ -static void savageDDColorMask_s4(GLcontext *ctx, +static void savageDDColorMask_s4(struct gl_context *ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) { @@ -855,7 +855,7 @@ static void savageDDColorMask_s4(GLcontext *ctx, imesa->dirty |= SAVAGE_UPLOAD_LOCAL; } } -static void savageDDColorMask_s3d(GLcontext *ctx, +static void savageDDColorMask_s3d(struct gl_context *ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) { @@ -865,7 +865,7 @@ static void savageDDColorMask_s3d(GLcontext *ctx, FALLBACK (ctx, SAVAGE_FALLBACK_COLORMASK, !(r && g && b)); } -static void savageUpdateSpecular_s4(GLcontext *ctx) { +static void savageUpdateSpecular_s4(struct gl_context *ctx) { savageContextPtr imesa = SAVAGE_CONTEXT( ctx ); uint32_t drawLocalCtrl = imesa->regs.s4.drawLocalCtrl.ui; @@ -879,7 +879,7 @@ static void savageUpdateSpecular_s4(GLcontext *ctx) { imesa->dirty |= SAVAGE_UPLOAD_LOCAL; } -static void savageUpdateSpecular_s3d(GLcontext *ctx) { +static void savageUpdateSpecular_s3d(struct gl_context *ctx) { savageContextPtr imesa = SAVAGE_CONTEXT( ctx ); uint32_t drawCtrl = imesa->regs.s3d.drawCtrl.ui; @@ -893,18 +893,18 @@ static void savageUpdateSpecular_s3d(GLcontext *ctx) { imesa->dirty |= SAVAGE_UPLOAD_LOCAL; } -static void savageDDLightModelfv_s4(GLcontext *ctx, GLenum pname, +static void savageDDLightModelfv_s4(struct gl_context *ctx, GLenum pname, const GLfloat *param) { savageUpdateSpecular_s4 (ctx); } -static void savageDDLightModelfv_s3d(GLcontext *ctx, GLenum pname, +static void savageDDLightModelfv_s3d(struct gl_context *ctx, GLenum pname, const GLfloat *param) { savageUpdateSpecular_s3d (ctx); } -static void savageDDShadeModel_s4(GLcontext *ctx, GLuint mod) +static void savageDDShadeModel_s4(struct gl_context *ctx, GLuint mod) { savageContextPtr imesa = SAVAGE_CONTEXT( ctx ); uint32_t drawLocalCtrl = imesa->regs.s4.drawLocalCtrl.ui; @@ -921,7 +921,7 @@ static void savageDDShadeModel_s4(GLcontext *ctx, GLuint mod) if (drawLocalCtrl != imesa->regs.s4.drawLocalCtrl.ui) imesa->dirty |= SAVAGE_UPLOAD_LOCAL; } -static void savageDDShadeModel_s3d(GLcontext *ctx, GLuint mod) +static void savageDDShadeModel_s3d(struct gl_context *ctx, GLuint mod) { savageContextPtr imesa = SAVAGE_CONTEXT( ctx ); uint32_t drawCtrl = imesa->regs.s3d.drawCtrl.ui; @@ -946,7 +946,7 @@ static void savageDDShadeModel_s3d(GLcontext *ctx, GLuint mod) * on savage3d and savage4. No need for two separate functions. */ -static void savageDDFogfv(GLcontext *ctx, GLenum pname, const GLfloat *param) +static void savageDDFogfv(struct gl_context *ctx, GLenum pname, const GLfloat *param) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); GLuint fogClr; @@ -977,7 +977,7 @@ static void savageDDFogfv(GLcontext *ctx, GLenum pname, const GLfloat *param) static void -savageDDStencilFuncSeparate(GLcontext *ctx, GLenum face, GLenum func, +savageDDStencilFuncSeparate(struct gl_context *ctx, GLenum face, GLenum func, GLint ref, GLuint mask) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -1010,7 +1010,7 @@ savageDDStencilFuncSeparate(GLcontext *ctx, GLenum face, GLenum func, } static void -savageDDStencilMaskSeparate(GLcontext *ctx, GLenum face, GLuint mask) +savageDDStencilMaskSeparate(struct gl_context *ctx, GLenum face, GLuint mask) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -1039,7 +1039,7 @@ static unsigned get_stencil_op_value( GLenum op ) } static void -savageDDStencilOpSeparate(GLcontext *ctx, GLenum face, GLenum fail, +savageDDStencilOpSeparate(struct gl_context *ctx, GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -1057,7 +1057,7 @@ savageDDStencilOpSeparate(GLcontext *ctx, GLenum face, GLenum fail, /* ============================================================= */ -static void savageDDEnable_s4(GLcontext *ctx, GLenum cap, GLboolean state) +static void savageDDEnable_s4(struct gl_context *ctx, GLenum cap, GLboolean state) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -1148,7 +1148,7 @@ static void savageDDEnable_s4(GLcontext *ctx, GLenum cap, GLboolean state) ; } } -static void savageDDEnable_s3d(GLcontext *ctx, GLenum cap, GLboolean state) +static void savageDDEnable_s3d(struct gl_context *ctx, GLenum cap, GLboolean state) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -1227,7 +1227,7 @@ static void savageDDEnable_s3d(GLcontext *ctx, GLenum cap, GLboolean state) } } -void savageDDUpdateHwState( GLcontext *ctx ) +void savageDDUpdateHwState( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -1671,7 +1671,7 @@ void savageDDInitState( savageContextPtr imesa ) { NEW_TEXTURE_MATRIX|\ NEW_USER_CLIP|NEW_CLIENT_STATE)) -static void savageDDInvalidateState( GLcontext *ctx, GLuint new_state ) +static void savageDDInvalidateState( struct gl_context *ctx, GLuint new_state ) { _swrast_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); @@ -1681,7 +1681,7 @@ static void savageDDInvalidateState( GLcontext *ctx, GLuint new_state ) } -void savageDDInitStateFuncs(GLcontext *ctx) +void savageDDInitStateFuncs(struct gl_context *ctx) { ctx->Driver.UpdateState = savageDDInvalidateState; ctx->Driver.BlendEquationSeparate = savageDDBlendEquationSeparate; diff --git a/src/mesa/drivers/dri/savage/savagestate.h b/src/mesa/drivers/dri/savage/savagestate.h index 5fe718d7a6..dca4fd0c01 100644 --- a/src/mesa/drivers/dri/savage/savagestate.h +++ b/src/mesa/drivers/dri/savage/savagestate.h @@ -28,14 +28,14 @@ #include "savagecontext.h" -void savageCalcViewport( GLcontext *ctx ); +void savageCalcViewport( struct gl_context *ctx ); void savageEmitOldState( savageContextPtr imesa ); void savageEmitChangedState( savageContextPtr imesa ); -extern void savageDDUpdateHwState( GLcontext *ctx ); +extern void savageDDUpdateHwState( struct gl_context *ctx ); extern void savageDDInitState( savageContextPtr imesa ); -extern void savageDDInitStateFuncs( GLcontext *ctx ); -extern void savageDDRenderStart(GLcontext *ctx); -extern void savageDDRenderEnd(GLcontext *ctx); +extern void savageDDInitStateFuncs( struct gl_context *ctx ); +extern void savageDDRenderStart(struct gl_context *ctx); +extern void savageDDRenderEnd(struct gl_context *ctx); #endif diff --git a/src/mesa/drivers/dri/savage/savagetex.c b/src/mesa/drivers/dri/savage/savagetex.c index 1523af4065..3aece732c9 100644 --- a/src/mesa/drivers/dri/savage/savagetex.c +++ b/src/mesa/drivers/dri/savage/savagetex.c @@ -28,7 +28,6 @@ #include "main/macros.h" #include "main/texstore.h" #include "main/texobj.h" -#include "main/convolve.h" #include "main/colormac.h" #include "main/simple_list.h" #include "main/enums.h" @@ -586,7 +585,6 @@ _savage_texstore_a1114444(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLuint texelBytes = _mesa_get_format_bytes(dstFormat); GLubyte *dstRow = (GLubyte *) dstAddr @@ -626,7 +624,6 @@ _savage_texstore_a1118888(TEXSTORE_PARAMS) if (!tempImage) return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLuint texelBytes = _mesa_get_format_bytes(dstFormat); GLubyte *dstRow = (GLubyte *) dstAddr @@ -652,7 +649,7 @@ _savage_texstore_a1118888(TEXSTORE_PARAMS) /* Called by the _mesa_store_teximage[123]d() functions. */ static gl_format -savageChooseTextureFormat( GLcontext *ctx, GLint internalFormat, +savageChooseTextureFormat( struct gl_context *ctx, GLint internalFormat, GLenum format, GLenum type ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -1151,7 +1148,7 @@ savage4_set_filter_mode( savageContextPtr imesa, unsigned unit, } -static void savageUpdateTex0State_s4( GLcontext *ctx ) +static void savageUpdateTex0State_s4( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); struct gl_texture_object *tObj; @@ -1395,7 +1392,7 @@ static void savageUpdateTex0State_s4( GLcontext *ctx ) return; } -static void savageUpdateTex1State_s4( GLcontext *ctx ) +static void savageUpdateTex1State_s4( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); struct gl_texture_object *tObj; @@ -1578,7 +1575,7 @@ static void savageUpdateTex1State_s4( GLcontext *ctx ) if(t->base.heap->heapId == SAVAGE_AGP_HEAP) imesa->regs.s4.texAddr[1].ui |= 0x1; } -static void savageUpdateTexState_s3d( GLcontext *ctx ) +static void savageUpdateTexState_s3d( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); struct gl_texture_object *tObj; @@ -1749,7 +1746,7 @@ static void savageTimestampTextures( savageContextPtr imesa ) } -static void savageUpdateTextureState_s4( GLcontext *ctx ) +static void savageUpdateTextureState_s4( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -1774,7 +1771,7 @@ static void savageUpdateTextureState_s4( GLcontext *ctx ) imesa->dirty |= (SAVAGE_UPLOAD_TEX0 | SAVAGE_UPLOAD_TEX1); } -static void savageUpdateTextureState_s3d( GLcontext *ctx ) +static void savageUpdateTextureState_s3d( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -1792,7 +1789,7 @@ static void savageUpdateTextureState_s3d( GLcontext *ctx ) savageUpdateTexState_s3d( ctx ); imesa->dirty |= (SAVAGE_UPLOAD_TEX0); } -void savageUpdateTextureState( GLcontext *ctx) +void savageUpdateTextureState( struct gl_context *ctx) { savageContextPtr imesa = SAVAGE_CONTEXT( ctx ); FALLBACK (ctx, SAVAGE_FALLBACK_TEXTURE, GL_FALSE); @@ -1809,7 +1806,7 @@ void savageUpdateTextureState( GLcontext *ctx) * DRIVER functions *****************************************/ -static void savageTexEnv( GLcontext *ctx, GLenum target, +static void savageTexEnv( struct gl_context *ctx, GLenum target, GLenum pname, const GLfloat *param ) { savageContextPtr imesa = SAVAGE_CONTEXT( ctx ); @@ -1850,7 +1847,7 @@ static void savageTexImageChanged (savageTexObjPtr t) { } } -static void savageTexImage1D( GLcontext *ctx, GLenum target, GLint level, +static void savageTexImage1D( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -1875,7 +1872,7 @@ static void savageTexImage1D( GLcontext *ctx, GLenum target, GLint level, SAVAGE_CONTEXT(ctx)->new_state |= SAVAGE_NEW_TEXTURE; } -static void savageTexSubImage1D( GLcontext *ctx, +static void savageTexSubImage1D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, @@ -1907,7 +1904,7 @@ static void savageTexSubImage1D( GLcontext *ctx, SAVAGE_CONTEXT(ctx)->new_state |= SAVAGE_NEW_TEXTURE; } -static void savageTexImage2D( GLcontext *ctx, GLenum target, GLint level, +static void savageTexImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -1932,7 +1929,7 @@ static void savageTexImage2D( GLcontext *ctx, GLenum target, GLint level, SAVAGE_CONTEXT(ctx)->new_state |= SAVAGE_NEW_TEXTURE; } -static void savageTexSubImage2D( GLcontext *ctx, +static void savageTexSubImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -1965,7 +1962,7 @@ static void savageTexSubImage2D( GLcontext *ctx, } static void -savageCompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level, +savageCompressedTexImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLsizei imageSize, const GLvoid *data, @@ -1990,7 +1987,7 @@ savageCompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level, } static void -savageCompressedTexSubImage2D( GLcontext *ctx, +savageCompressedTexSubImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -2021,7 +2018,7 @@ savageCompressedTexSubImage2D( GLcontext *ctx, SAVAGE_CONTEXT(ctx)->new_state |= SAVAGE_NEW_TEXTURE; } -static void savageTexParameter( GLcontext *ctx, GLenum target, +static void savageTexParameter( struct gl_context *ctx, GLenum target, struct gl_texture_object *tObj, GLenum pname, const GLfloat *params ) { @@ -2053,7 +2050,7 @@ static void savageTexParameter( GLcontext *ctx, GLenum target, imesa->new_state |= SAVAGE_NEW_TEXTURE; } -static void savageBindTexture( GLcontext *ctx, GLenum target, +static void savageBindTexture( struct gl_context *ctx, GLenum target, struct gl_texture_object *tObj ) { savageContextPtr imesa = SAVAGE_CONTEXT( ctx ); @@ -2064,7 +2061,7 @@ static void savageBindTexture( GLcontext *ctx, GLenum target, imesa->new_state |= SAVAGE_NEW_TEXTURE; } -static void savageDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj ) +static void savageDeleteTexture( struct gl_context *ctx, struct gl_texture_object *tObj ) { driTextureObject *t = (driTextureObject *)tObj->DriverData; savageContextPtr imesa = SAVAGE_CONTEXT( ctx ); @@ -2081,7 +2078,7 @@ static void savageDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj static struct gl_texture_object * -savageNewTextureObject( GLcontext *ctx, GLuint name, GLenum target ) +savageNewTextureObject( struct gl_context *ctx, GLuint name, GLenum target ) { struct gl_texture_object *obj; obj = _mesa_new_texture_object(ctx, name, target); diff --git a/src/mesa/drivers/dri/savage/savagetex.h b/src/mesa/drivers/dri/savage/savagetex.h index e5f8a80f85..6108c1aade 100644 --- a/src/mesa/drivers/dri/savage/savagetex.h +++ b/src/mesa/drivers/dri/savage/savagetex.h @@ -75,7 +75,7 @@ typedef struct { #define __HWParseTexEnvCombine(imesa, flag0, TexCtrl, TexBlendCtrl) -void savageUpdateTextureState( GLcontext *ctx ); +void savageUpdateTextureState( struct gl_context *ctx ); void savageDDInitTextureFuncs( struct dd_function_table *functions ); void savageDestroyTexObj( savageContextPtr imesa, savageTexObjPtr t ); diff --git a/src/mesa/drivers/dri/savage/savagetris.c b/src/mesa/drivers/dri/savage/savagetris.c index 0050485e31..79a951147f 100644 --- a/src/mesa/drivers/dri/savage/savagetris.c +++ b/src/mesa/drivers/dri/savage/savagetris.c @@ -53,8 +53,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "savagetex.h" #include "savageioctl.h" -static void savageRasterPrimitive( GLcontext *ctx, GLuint prim ); -static void savageRenderPrimitive( GLcontext *ctx, GLenum prim ); +static void savageRasterPrimitive( struct gl_context *ctx, GLuint prim ); +static void savageRenderPrimitive( struct gl_context *ctx, GLenum prim ); static GLenum reduced_prim[GL_POLYGON+1] = { @@ -562,7 +562,7 @@ savage_fallback_tri( savageContextPtr imesa, savageVertexPtr v1, savageVertexPtr v2 ) { - GLcontext *ctx = imesa->glCtx; + struct gl_context *ctx = imesa->glCtx; SWvertex v[3]; FLUSH_BATCH(imesa); WAIT_IDLE_EMPTY(imesa); @@ -578,7 +578,7 @@ savage_fallback_line( savageContextPtr imesa, savageVertexPtr v0, savageVertexPtr v1 ) { - GLcontext *ctx = imesa->glCtx; + struct gl_context *ctx = imesa->glCtx; SWvertex v[2]; FLUSH_BATCH(imesa); WAIT_IDLE_EMPTY(imesa); @@ -592,7 +592,7 @@ static void savage_fallback_point( savageContextPtr imesa, savageVertexPtr v0 ) { - GLcontext *ctx = imesa->glCtx; + struct gl_context *ctx = imesa->glCtx; SWvertex v[1]; FLUSH_BATCH(imesa); WAIT_IDLE_EMPTY(imesa); @@ -645,7 +645,7 @@ savage_fallback_point( savageContextPtr imesa, /* Render clipped primitives */ /**********************************************************************/ -static void savageRenderClippedPoly( GLcontext *ctx, const GLuint *elts, +static void savageRenderClippedPoly( struct gl_context *ctx, const GLuint *elts, GLuint n ) { TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -661,13 +661,13 @@ static void savageRenderClippedPoly( GLcontext *ctx, const GLuint *elts, } } -static void savageRenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) +static void savageRenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->Driver.Render.Line( ctx, ii, jj ); } /* -static void savageFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, +static void savageFastRenderClippedPoly( struct gl_context *ctx, const GLuint *elts, GLuint n ) { r128ContextPtr rmesa = R128_CONTEXT( ctx ); @@ -711,7 +711,7 @@ static void savageFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, #define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED) -static void savageChooseRenderState(GLcontext *ctx) +static void savageChooseRenderState(struct gl_context *ctx) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); GLuint flags = ctx->_TriangleCaps; @@ -781,7 +781,7 @@ static void savageChooseRenderState(GLcontext *ctx) /* Validate state at pipeline start */ /**********************************************************************/ -static void savageRunPipeline( GLcontext *ctx ) +static void savageRunPipeline( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -829,7 +829,7 @@ static void savageRunPipeline( GLcontext *ctx ) * primitives. */ -static void savageRasterPrimitive( GLcontext *ctx, GLuint prim ) +static void savageRasterPrimitive( struct gl_context *ctx, GLuint prim ) { savageContextPtr imesa = SAVAGE_CONTEXT( ctx ); @@ -851,7 +851,7 @@ static void savageRasterPrimitive( GLcontext *ctx, GLuint prim ) #endif } -static void savageRenderPrimitive( GLcontext *ctx, GLenum prim ) +static void savageRenderPrimitive( struct gl_context *ctx, GLenum prim ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); GLuint rprim = reduced_prim[prim]; @@ -870,7 +870,7 @@ static void savageRenderPrimitive( GLcontext *ctx, GLenum prim ) * them. Fallback to swrast we can't. Returns GL_TRUE if projective * texture coordinates must be faked, GL_FALSE otherwise. */ -static GLboolean savageCheckPTexHack( GLcontext *ctx ) +static GLboolean savageCheckPTexHack( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; @@ -933,7 +933,7 @@ do { \ #define SAVAGE_EMIT_ST1 0x0300 -static INLINE GLuint savageChooseVertexFormat_s3d( GLcontext *ctx ) +static INLINE GLuint savageChooseVertexFormat_s3d( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -996,7 +996,7 @@ static INLINE GLuint savageChooseVertexFormat_s3d( GLcontext *ctx ) } -static INLINE GLuint savageChooseVertexFormat_s4( GLcontext *ctx ) +static INLINE GLuint savageChooseVertexFormat_s4( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -1121,7 +1121,7 @@ static INLINE GLuint savageChooseVertexFormat_s4( GLcontext *ctx ) } -static void savageRenderStart( GLcontext *ctx ) +static void savageRenderStart( struct gl_context *ctx ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -1199,7 +1199,7 @@ static void savageRenderStart( GLcontext *ctx ) } } -static void savageRenderFinish( GLcontext *ctx ) +static void savageRenderFinish( struct gl_context *ctx ) { /* Flush the last primitive now, before any state is changed. */ savageFlushVertices(SAVAGE_CONTEXT(ctx)); @@ -1227,7 +1227,7 @@ static const char * const fallbackStrings[] = { "Projective texture", }; -void savageFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) +void savageFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ) { TNLcontext *tnl = TNL_CONTEXT(ctx); savageContextPtr imesa = SAVAGE_CONTEXT(ctx); @@ -1279,7 +1279,7 @@ void savageFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) /* Initialization. */ /**********************************************************************/ -void savageInitTriFuncs( GLcontext *ctx ) +void savageInitTriFuncs( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); static int firsttime = 1; diff --git a/src/mesa/drivers/dri/savage/savagetris.h b/src/mesa/drivers/dri/savage/savagetris.h index a2a9375ed5..5dcae78f76 100644 --- a/src/mesa/drivers/dri/savage/savagetris.h +++ b/src/mesa/drivers/dri/savage/savagetris.h @@ -38,10 +38,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/mtypes.h" -extern void savageInitTriFuncs( GLcontext *ctx ); +extern void savageInitTriFuncs( struct gl_context *ctx ); -extern void savageFallback( GLcontext *ctx, GLuint bit, GLboolean mode ); +extern void savageFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ); #define FALLBACK( ctx, bit, mode ) savageFallback( ctx, bit, mode ) diff --git a/src/mesa/drivers/dri/sis/sis6326_clear.c b/src/mesa/drivers/dri/sis/sis6326_clear.c index d46ecc9cd2..fba6c7f2d7 100644 --- a/src/mesa/drivers/dri/sis/sis6326_clear.c +++ b/src/mesa/drivers/dri/sis/sis6326_clear.c @@ -34,11 +34,11 @@ #include "swrast/swrast.h" #include "main/macros.h" -static void sis_clear_front_buffer(GLcontext *ctx, GLenum mask, GLint x, +static void sis_clear_front_buffer(struct gl_context *ctx, GLenum mask, GLint x, GLint y, GLint width, GLint height); -static void sis_clear_back_buffer(GLcontext *ctx, GLenum mask, GLint x, +static void sis_clear_back_buffer(struct gl_context *ctx, GLenum mask, GLint x, GLint y, GLint width, GLint height); -static void sis_clear_z_buffer(GLcontext * ctx, GLbitfield mask, GLint x, +static void sis_clear_z_buffer(struct gl_context * ctx, GLbitfield mask, GLint x, GLint y, GLint width, GLint height ); static void @@ -69,7 +69,7 @@ sis6326UpdateZPattern(sisContextPtr smesa, GLclampd z) } void -sis6326DDClear(GLcontext *ctx, GLbitfield mask) +sis6326DDClear(struct gl_context *ctx, GLbitfield mask) { sisContextPtr smesa = SIS_CONTEXT(ctx); GLint x1, y1, width1, height1; @@ -114,7 +114,7 @@ sis6326DDClear(GLcontext *ctx, GLbitfield mask) void -sis6326DDClearColor(GLcontext *ctx, const GLfloat color[4]) +sis6326DDClearColor(struct gl_context *ctx, const GLfloat color[4]) { sisContextPtr smesa = SIS_CONTEXT(ctx); GLubyte c[4]; @@ -128,7 +128,7 @@ sis6326DDClearColor(GLcontext *ctx, const GLfloat color[4]) } void -sis6326DDClearDepth(GLcontext *ctx, GLclampd d) +sis6326DDClearDepth(struct gl_context *ctx, GLclampd d) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -136,7 +136,7 @@ sis6326DDClearDepth(GLcontext *ctx, GLclampd d) } static void -sis_clear_back_buffer(GLcontext *ctx, GLenum mask, GLint x, GLint y, +sis_clear_back_buffer(struct gl_context *ctx, GLenum mask, GLint x, GLint y, GLint width, GLint height) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -160,7 +160,7 @@ sis_clear_back_buffer(GLcontext *ctx, GLenum mask, GLint x, GLint y, } static void -sis_clear_front_buffer(GLcontext *ctx, GLenum mask, GLint x, GLint y, +sis_clear_front_buffer(struct gl_context *ctx, GLenum mask, GLint x, GLint y, GLint width, GLint height) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -211,7 +211,7 @@ sis_clear_front_buffer(GLcontext *ctx, GLenum mask, GLint x, GLint y, } static void -sis_clear_z_buffer(GLcontext * ctx, GLbitfield mask, GLint x, GLint y, +sis_clear_z_buffer(struct gl_context * ctx, GLbitfield mask, GLint x, GLint y, GLint width, GLint height) { sisContextPtr smesa = SIS_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/sis/sis6326_state.c b/src/mesa/drivers/dri/sis/sis6326_state.c index 52008c7ea3..9708f63912 100644 --- a/src/mesa/drivers/dri/sis/sis6326_state.c +++ b/src/mesa/drivers/dri/sis/sis6326_state.c @@ -46,7 +46,7 @@ */ static void -sis6326DDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) +sis6326DDAlphaFunc( struct gl_context *ctx, GLenum func, GLfloat ref ) { sisContextPtr smesa = SIS_CONTEXT(ctx); GLubyte refbyte; @@ -91,7 +91,7 @@ sis6326DDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) } static void -sis6326DDBlendFuncSeparate( GLcontext *ctx, +sis6326DDBlendFuncSeparate( struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) { @@ -172,7 +172,7 @@ sis6326DDBlendFuncSeparate( GLcontext *ctx, */ static void -sis6326DDDepthFunc( GLcontext *ctx, GLenum func ) +sis6326DDDepthFunc( struct gl_context *ctx, GLenum func ) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *prev = &smesa->prev; @@ -214,7 +214,7 @@ sis6326DDDepthFunc( GLcontext *ctx, GLenum func ) } static void -sis6326DDDepthMask( GLcontext *ctx, GLboolean flag ) +sis6326DDDepthMask( struct gl_context *ctx, GLboolean flag ) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *current = &smesa->current; @@ -230,7 +230,7 @@ sis6326DDDepthMask( GLcontext *ctx, GLboolean flag ) */ static void -sis6326DDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *params ) +sis6326DDFogfv( struct gl_context *ctx, GLenum pname, const GLfloat *params ) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *current = &smesa->current; @@ -258,7 +258,7 @@ sis6326DDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *params ) */ void -sis6326UpdateClipping(GLcontext *ctx) +sis6326UpdateClipping(struct gl_context *ctx) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -300,7 +300,7 @@ sis6326UpdateClipping(GLcontext *ctx) } static void -sis6326DDScissor( GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) +sis6326DDScissor( struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) { if (ctx->Scissor.Enabled) sis6326UpdateClipping( ctx ); @@ -311,20 +311,20 @@ sis6326DDScissor( GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) */ static void -sis6326UpdateCull( GLcontext *ctx ) +sis6326UpdateCull( struct gl_context *ctx ) { /* XXX culling */ } static void -sis6326DDCullFace( GLcontext *ctx, GLenum mode ) +sis6326DDCullFace( struct gl_context *ctx, GLenum mode ) { sis6326UpdateCull( ctx ); } static void -sis6326DDFrontFace( GLcontext *ctx, GLenum mode ) +sis6326DDFrontFace( struct gl_context *ctx, GLenum mode ) { sis6326UpdateCull( ctx ); } @@ -333,7 +333,7 @@ sis6326DDFrontFace( GLcontext *ctx, GLenum mode ) * Masks */ -static void sis6326DDColorMask( GLcontext *ctx, +static void sis6326DDColorMask( struct gl_context *ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) { @@ -350,7 +350,7 @@ static void sis6326DDColorMask( GLcontext *ctx, * Rendering attributes */ -static void sis6326UpdateSpecular(GLcontext *ctx) +static void sis6326UpdateSpecular(struct gl_context *ctx) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *current = &smesa->current; @@ -361,14 +361,14 @@ static void sis6326UpdateSpecular(GLcontext *ctx) current->hwCapEnable &= ~S_ENABLE_Specular; } -static void sis6326DDLightModelfv(GLcontext *ctx, GLenum pname, +static void sis6326DDLightModelfv(struct gl_context *ctx, GLenum pname, const GLfloat *param) { if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) { sis6326UpdateSpecular(ctx); } } -static void sis6326DDShadeModel( GLcontext *ctx, GLenum mode ) +static void sis6326DDShadeModel( struct gl_context *ctx, GLenum mode ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -384,7 +384,7 @@ static void sis6326DDShadeModel( GLcontext *ctx, GLenum mode ) * Viewport */ -static void sis6326CalcViewport( GLcontext *ctx ) +static void sis6326CalcViewport( struct gl_context *ctx ) { sisContextPtr smesa = SIS_CONTEXT(ctx); const GLfloat *v = ctx->Viewport._WindowMap.m; @@ -400,14 +400,14 @@ static void sis6326CalcViewport( GLcontext *ctx ) m[MAT_TZ] = v[MAT_TZ] * smesa->depth_scale; } -static void sis6326DDViewport( GLcontext *ctx, +static void sis6326DDViewport( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) { sis6326CalcViewport( ctx ); } -static void sis6326DDDepthRange( GLcontext *ctx, +static void sis6326DDDepthRange( struct gl_context *ctx, GLclampd nearval, GLclampd farval ) { sis6326CalcViewport( ctx ); @@ -418,7 +418,7 @@ static void sis6326DDDepthRange( GLcontext *ctx, */ static void -sis6326DDLogicOpCode( GLcontext *ctx, GLenum opcode ) +sis6326DDLogicOpCode( struct gl_context *ctx, GLenum opcode ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -487,7 +487,7 @@ sis6326DDLogicOpCode( GLcontext *ctx, GLenum opcode ) } } -void sis6326DDDrawBuffer( GLcontext *ctx, GLenum mode ) +void sis6326DDDrawBuffer( struct gl_context *ctx, GLenum mode ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -544,7 +544,7 @@ void sis6326DDDrawBuffer( GLcontext *ctx, GLenum mode ) */ static void -sis6326DDEnable( GLcontext *ctx, GLenum cap, GLboolean state ) +sis6326DDEnable( struct gl_context *ctx, GLenum cap, GLboolean state ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -617,7 +617,7 @@ sis6326DDEnable( GLcontext *ctx, GLenum cap, GLboolean state ) /* Called before beginning of rendering. */ void -sis6326UpdateHWState( GLcontext *ctx ) +sis6326UpdateHWState( struct gl_context *ctx ) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *prev = &smesa->prev; @@ -639,7 +639,7 @@ sis6326UpdateHWState( GLcontext *ctx ) } static void -sis6326DDInvalidateState( GLcontext *ctx, GLuint new_state ) +sis6326DDInvalidateState( struct gl_context *ctx, GLuint new_state ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -656,7 +656,7 @@ void sis6326DDInitState( sisContextPtr smesa ) { __GLSiSHardware *prev = &smesa->prev; __GLSiSHardware *current = &smesa->current; - GLcontext *ctx = smesa->glCtx; + struct gl_context *ctx = smesa->glCtx; /* add Texture Perspective Enable */ current->hwCapEnable = S_ENABLE_TextureCache | @@ -708,7 +708,7 @@ void sis6326DDInitState( sisContextPtr smesa ) /* Initialize the driver's state functions. */ -void sis6326DDInitStateFuncs( GLcontext *ctx ) +void sis6326DDInitStateFuncs( struct gl_context *ctx ) { ctx->Driver.UpdateState = sis6326DDInvalidateState; diff --git a/src/mesa/drivers/dri/sis/sis_clear.c b/src/mesa/drivers/dri/sis/sis_clear.c index d358ef62dc..a5d870469d 100644 --- a/src/mesa/drivers/dri/sis/sis_clear.c +++ b/src/mesa/drivers/dri/sis/sis_clear.c @@ -38,12 +38,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "swrast/swrast.h" #include "main/macros.h" -static GLbitfield sis_3D_Clear( GLcontext * ctx, GLbitfield mask, +static GLbitfield sis_3D_Clear( struct gl_context * ctx, GLbitfield mask, GLint x, GLint y, GLint width, GLint height ); -static void sis_clear_color_buffer( GLcontext *ctx, GLenum mask, GLint x, +static void sis_clear_color_buffer( struct gl_context *ctx, GLenum mask, GLint x, GLint y, GLint width, GLint height ); -static void sis_clear_z_stencil_buffer( GLcontext * ctx, +static void sis_clear_z_stencil_buffer( struct gl_context * ctx, GLbitfield mask, GLint x, GLint y, GLint width, GLint height ); @@ -94,7 +94,7 @@ sisUpdateZStencilPattern( sisContextPtr smesa, GLclampd z, GLint stencil ) } void -sisDDClear( GLcontext * ctx, GLbitfield mask ) +sisDDClear( struct gl_context * ctx, GLbitfield mask ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -148,7 +148,7 @@ sisDDClear( GLcontext * ctx, GLbitfield mask ) void -sisDDClearColor( GLcontext * ctx, const GLfloat color[4] ) +sisDDClearColor( struct gl_context * ctx, const GLfloat color[4] ) { sisContextPtr smesa = SIS_CONTEXT(ctx); GLubyte c[4]; @@ -162,7 +162,7 @@ sisDDClearColor( GLcontext * ctx, const GLfloat color[4] ) } void -sisDDClearDepth( GLcontext * ctx, GLclampd d ) +sisDDClearDepth( struct gl_context * ctx, GLclampd d ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -170,7 +170,7 @@ sisDDClearDepth( GLcontext * ctx, GLclampd d ) } void -sisDDClearStencil( GLcontext * ctx, GLint s ) +sisDDClearStencil( struct gl_context * ctx, GLint s ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -178,7 +178,7 @@ sisDDClearStencil( GLcontext * ctx, GLint s ) } static GLbitfield -sis_3D_Clear( GLcontext * ctx, GLbitfield mask, +sis_3D_Clear( struct gl_context * ctx, GLbitfield mask, GLint x, GLint y, GLint width, GLint height ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -323,7 +323,7 @@ sis_3D_Clear( GLcontext * ctx, GLbitfield mask, } static void -sis_clear_color_buffer( GLcontext *ctx, GLenum mask, GLint x, GLint y, +sis_clear_color_buffer( struct gl_context *ctx, GLenum mask, GLint x, GLint y, GLint width, GLint height ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -389,7 +389,7 @@ sis_clear_color_buffer( GLcontext *ctx, GLenum mask, GLint x, GLint y, } static void -sis_clear_z_stencil_buffer( GLcontext * ctx, GLbitfield mask, +sis_clear_z_stencil_buffer( struct gl_context * ctx, GLbitfield mask, GLint x, GLint y, GLint width, GLint height ) { sisContextPtr smesa = SIS_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/sis/sis_context.c b/src/mesa/drivers/dri/sis/sis_context.c index 85f26a08b7..c5a9fdfb2a 100644 --- a/src/mesa/drivers/dri/sis/sis_context.c +++ b/src/mesa/drivers/dri/sis/sis_context.c @@ -147,7 +147,7 @@ WaitingFor3dIdle(sisContextPtr smesa, int wLen) } } -void sisReAllocateBuffers(GLcontext *ctx, GLframebuffer *drawbuffer, +void sisReAllocateBuffers(struct gl_context *ctx, struct gl_framebuffer *drawbuffer, GLuint width, GLuint height) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -159,11 +159,11 @@ void sisReAllocateBuffers(GLcontext *ctx, GLframebuffer *drawbuffer, GLboolean sisCreateContext( gl_api api, - const __GLcontextModes *glVisual, + const struct gl_config *glVisual, __DRIcontext *driContextPriv, void *sharedContextPrivate ) { - GLcontext *ctx, *shareCtx; + struct gl_context *ctx, *shareCtx; __DRIscreen *sPriv = driContextPriv->driScreenPriv; sisContextPtr smesa; sisScreenPtr sisScreen; @@ -381,8 +381,8 @@ sisMakeCurrent( __DRIcontext *driContextPriv, newSisCtx->driDrawable = driDrawPriv; - drawBuffer = (GLframebuffer *)driDrawPriv->driverPrivate; - readBuffer = (GLframebuffer *)driReadPriv->driverPrivate; + drawBuffer = (struct gl_framebuffer *)driDrawPriv->driverPrivate; + readBuffer = (struct gl_framebuffer *)driReadPriv->driverPrivate; _mesa_make_current( newSisCtx->glCtx, drawBuffer, readBuffer ); diff --git a/src/mesa/drivers/dri/sis/sis_context.h b/src/mesa/drivers/dri/sis/sis_context.h index 132cee33ee..a82a659431 100644 --- a/src/mesa/drivers/dri/sis/sis_context.h +++ b/src/mesa/drivers/dri/sis/sis_context.h @@ -256,7 +256,7 @@ struct sis_renderbuffer { struct sis_context { /* This must be first in this structure */ - GLcontext *glCtx; + struct gl_context *glCtx; /* Vertex state */ GLuint vertex_size; @@ -439,12 +439,12 @@ enum _sis_verbose { }; extern GLboolean sisCreateContext( gl_api api, - const __GLcontextModes *glVisual, + const struct gl_config *glVisual, __DRIcontext *driContextPriv, void *sharedContextPrivate ); extern void sisDestroyContext( __DRIcontext * ); -void sisReAllocateBuffers(GLcontext *ctx, GLframebuffer *drawbuffer, +void sisReAllocateBuffers(struct gl_context *ctx, struct gl_framebuffer *drawbuffer, GLuint width, GLuint height); extern GLboolean sisMakeCurrent( __DRIcontext *driContextPriv, diff --git a/src/mesa/drivers/dri/sis/sis_dd.c b/src/mesa/drivers/dri/sis/sis_dd.c index fe4ade8592..90e894b842 100644 --- a/src/mesa/drivers/dri/sis/sis_dd.c +++ b/src/mesa/drivers/dri/sis/sis_dd.c @@ -50,7 +50,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* Return the width and height of the given buffer. */ static void -sisGetBufferSize( GLframebuffer *buffer, +sisGetBufferSize( struct gl_framebuffer *buffer, GLuint *width, GLuint *height ) { GET_CURRENT_CONTEXT(ctx); @@ -65,7 +65,7 @@ sisGetBufferSize( GLframebuffer *buffer, /* Return various strings for glGetString(). */ static const GLubyte * -sisGetString( GLcontext *ctx, GLenum name ) +sisGetString( struct gl_context *ctx, GLenum name ) { sisContextPtr smesa = SIS_CONTEXT(ctx); static char buffer[128]; @@ -90,7 +90,7 @@ sisGetString( GLcontext *ctx, GLenum name ) /* Send all commands to the hardware. */ static void -sisFlush( GLcontext *ctx ) +sisFlush( struct gl_context *ctx ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -101,7 +101,7 @@ sisFlush( GLcontext *ctx ) * completed processing. */ static void -sisFinish( GLcontext *ctx ) +sisFinish( struct gl_context *ctx ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -118,7 +118,7 @@ sisDeleteRenderbuffer(struct gl_renderbuffer *rb) } static GLboolean -sisRenderbufferStorage(GLcontext *ctx, struct gl_renderbuffer *rb, +sisRenderbufferStorage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { rb->Width = width; diff --git a/src/mesa/drivers/dri/sis/sis_fog.c b/src/mesa/drivers/dri/sis/sis_fog.c index 6c774e010e..a9b84654a3 100644 --- a/src/mesa/drivers/dri/sis/sis_fog.c +++ b/src/mesa/drivers/dri/sis/sis_fog.c @@ -40,7 +40,7 @@ static GLint convertFtToFogFt( GLfloat dwInValue ); static GLint doFPtoFixedNoRound( GLfloat dwInValue, int nFraction ); void -sisDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *params ) +sisDDFogfv( struct gl_context *ctx, GLenum pname, const GLfloat *params ) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *prev = &smesa->prev; diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c index 80fb455ec7..75f6fcf211 100644 --- a/src/mesa/drivers/dri/sis/sis_screen.c +++ b/src/mesa/drivers/dri/sis/sis_screen.c @@ -193,7 +193,7 @@ sisDestroyScreen( __DRIscreen *sPriv ) static GLboolean sisCreateBuffer( __DRIscreen *driScrnPriv, __DRIdrawable *driDrawPriv, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, GLboolean isPixmap ) { /*sisScreenPtr screen = (sisScreenPtr) driScrnPriv->private;*/ @@ -220,7 +220,7 @@ sisCreateBuffer( __DRIscreen *driScrnPriv, static void sisDestroyBuffer(__DRIdrawable *driDrawPriv) { - _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL); + _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL); } static void sisCopyBuffer( __DRIdrawable *dPriv ) @@ -262,7 +262,7 @@ sisSwapBuffers(__DRIdrawable *dPriv) { if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) { sisContextPtr smesa = (sisContextPtr) dPriv->driContextPriv->driverPrivate; - GLcontext *ctx = smesa->glCtx; + struct gl_context *ctx = smesa->glCtx; if (ctx->Visual.doubleBufferMode) { _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */ @@ -280,7 +280,7 @@ sisSwapBuffers(__DRIdrawable *dPriv) * * \todo maybe fold this into intelInitDriver * - * \return the __GLcontextModes supported by this driver + * \return the struct gl_config supported by this driver */ static const __DRIconfig ** sisInitScreen(__DRIscreen *psp) diff --git a/src/mesa/drivers/dri/sis/sis_span.c b/src/mesa/drivers/dri/sis/sis_span.c index 008b00160e..01c1fc428d 100644 --- a/src/mesa/drivers/dri/sis/sis_span.c +++ b/src/mesa/drivers/dri/sis/sis_span.c @@ -143,7 +143,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. -void sisSpanRenderStart( GLcontext *ctx ) +void sisSpanRenderStart( struct gl_context *ctx ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -152,7 +152,7 @@ void sisSpanRenderStart( GLcontext *ctx ) WaitEngIdle( smesa ); } -void sisSpanRenderFinish( GLcontext *ctx ) +void sisSpanRenderFinish( struct gl_context *ctx ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -161,7 +161,7 @@ void sisSpanRenderFinish( GLcontext *ctx ) } void -sisDDInitSpanFuncs( GLcontext *ctx ) +sisDDInitSpanFuncs( struct gl_context *ctx ) { struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx); swdd->SpanRenderStart = sisSpanRenderStart; @@ -174,7 +174,7 @@ sisDDInitSpanFuncs( GLcontext *ctx ) * Plug in the Get/Put routines for the given driRenderbuffer. */ void -sisSetSpanFunctions(struct sis_renderbuffer *srb, const GLvisual *vis) +sisSetSpanFunctions(struct sis_renderbuffer *srb, const struct gl_config *vis) { if (srb->Base.Format == MESA_FORMAT_RGB565) { sisInitPointers_RGB565( &srb->Base ); diff --git a/src/mesa/drivers/dri/sis/sis_span.h b/src/mesa/drivers/dri/sis/sis_span.h index a1f817c44c..cbe4bbdc55 100644 --- a/src/mesa/drivers/dri/sis/sis_span.h +++ b/src/mesa/drivers/dri/sis/sis_span.h @@ -34,12 +34,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "drirenderbuffer.h" -extern void sisSpanRenderStart( GLcontext *ctx ); -extern void sisSpanRenderFinish( GLcontext *ctx ); +extern void sisSpanRenderStart( struct gl_context *ctx ); +extern void sisSpanRenderFinish( struct gl_context *ctx ); -extern void sisDDInitSpanFuncs( GLcontext *ctx ); +extern void sisDDInitSpanFuncs( struct gl_context *ctx ); extern void -sisSetSpanFunctions(struct sis_renderbuffer *srb, const GLvisual *vis); +sisSetSpanFunctions(struct sis_renderbuffer *srb, const struct gl_config *vis); #endif diff --git a/src/mesa/drivers/dri/sis/sis_state.c b/src/mesa/drivers/dri/sis/sis_state.c index 6173231a82..e53c326441 100644 --- a/src/mesa/drivers/dri/sis/sis_state.c +++ b/src/mesa/drivers/dri/sis/sis_state.c @@ -49,7 +49,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. */ static void -sisDDAlphaFunc( GLcontext * ctx, GLenum func, GLfloat ref ) +sisDDAlphaFunc( struct gl_context * ctx, GLenum func, GLfloat ref ) { sisContextPtr smesa = SIS_CONTEXT(ctx); GLubyte refbyte; @@ -94,7 +94,7 @@ sisDDAlphaFunc( GLcontext * ctx, GLenum func, GLfloat ref ) } static void -sisDDBlendFuncSeparate( GLcontext *ctx, +sisDDBlendFuncSeparate( struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) { @@ -193,7 +193,7 @@ sisDDBlendFuncSeparate( GLcontext *ctx, */ static void -sisDDDepthFunc( GLcontext * ctx, GLenum func ) +sisDDDepthFunc( struct gl_context * ctx, GLenum func ) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *prev = &smesa->prev; @@ -235,7 +235,7 @@ sisDDDepthFunc( GLcontext * ctx, GLenum func ) } void -sisDDDepthMask( GLcontext * ctx, GLboolean flag ) +sisDDDepthMask( struct gl_context * ctx, GLboolean flag ) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *prev = &smesa->prev; @@ -277,7 +277,7 @@ sisDDDepthMask( GLcontext * ctx, GLboolean flag ) */ void -sisUpdateClipping( GLcontext *ctx ) +sisUpdateClipping( struct gl_context *ctx ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -324,7 +324,7 @@ sisUpdateClipping( GLcontext *ctx ) } static void -sisDDScissor( GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) +sisDDScissor( struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) { if (ctx->Scissor.Enabled) sisUpdateClipping( ctx ); @@ -335,7 +335,7 @@ sisDDScissor( GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) */ static void -sisUpdateCull( GLcontext *ctx ) +sisUpdateCull( struct gl_context *ctx ) { sisContextPtr smesa = SIS_CONTEXT(ctx); GLint cullflag, frontface; @@ -356,13 +356,13 @@ sisUpdateCull( GLcontext *ctx ) static void -sisDDCullFace( GLcontext *ctx, GLenum mode ) +sisDDCullFace( struct gl_context *ctx, GLenum mode ) { sisUpdateCull( ctx ); } static void -sisDDFrontFace( GLcontext *ctx, GLenum mode ) +sisDDFrontFace( struct gl_context *ctx, GLenum mode ) { sisUpdateCull( ctx ); } @@ -371,7 +371,7 @@ sisDDFrontFace( GLcontext *ctx, GLenum mode ) * Masks */ -static void sisDDColorMask( GLcontext *ctx, +static void sisDDColorMask( struct gl_context *ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) { @@ -402,7 +402,7 @@ static void sisDDColorMask( GLcontext *ctx, * Rendering attributes */ -static void sisUpdateSpecular(GLcontext *ctx) +static void sisUpdateSpecular(struct gl_context *ctx) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *current = &smesa->current; @@ -413,7 +413,7 @@ static void sisUpdateSpecular(GLcontext *ctx) current->hwCapEnable &= ~MASK_SpecularEnable; } -static void sisDDLightModelfv(GLcontext *ctx, GLenum pname, +static void sisDDLightModelfv(struct gl_context *ctx, GLenum pname, const GLfloat *param) { if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) { @@ -421,7 +421,7 @@ static void sisDDLightModelfv(GLcontext *ctx, GLenum pname, } } -static void sisDDShadeModel( GLcontext *ctx, GLenum mode ) +static void sisDDShadeModel( struct gl_context *ctx, GLenum mode ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -437,7 +437,7 @@ static void sisDDShadeModel( GLcontext *ctx, GLenum mode ) * Viewport */ -static void sisCalcViewport( GLcontext *ctx ) +static void sisCalcViewport( struct gl_context *ctx ) { sisContextPtr smesa = SIS_CONTEXT(ctx); const GLfloat *v = ctx->Viewport._WindowMap.m; @@ -453,14 +453,14 @@ static void sisCalcViewport( GLcontext *ctx ) m[MAT_TZ] = v[MAT_TZ] * smesa->depth_scale; } -static void sisDDViewport( GLcontext *ctx, +static void sisDDViewport( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) { sisCalcViewport( ctx ); } -static void sisDDDepthRange( GLcontext *ctx, +static void sisDDDepthRange( struct gl_context *ctx, GLclampd nearval, GLclampd farval ) { sisCalcViewport( ctx ); @@ -471,7 +471,7 @@ static void sisDDDepthRange( GLcontext *ctx, */ static void -sisDDLogicOpCode( GLcontext *ctx, GLenum opcode ) +sisDDLogicOpCode( struct gl_context *ctx, GLenum opcode ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -537,7 +537,7 @@ sisDDLogicOpCode( GLcontext *ctx, GLenum opcode ) } } -void sisDDDrawBuffer( GLcontext *ctx, GLenum mode ) +void sisDDDrawBuffer( struct gl_context *ctx, GLenum mode ) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *prev = &smesa->prev; @@ -589,7 +589,7 @@ void sisDDDrawBuffer( GLcontext *ctx, GLenum mode ) */ static void -sisDDEnable( GLcontext * ctx, GLenum cap, GLboolean state ) +sisDDEnable( struct gl_context * ctx, GLenum cap, GLboolean state ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -672,7 +672,7 @@ sisDDEnable( GLcontext * ctx, GLenum cap, GLboolean state ) /* Called before beginning of rendering. */ void -sisUpdateHWState( GLcontext *ctx ) +sisUpdateHWState( struct gl_context *ctx ) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *prev = &smesa->prev; @@ -698,7 +698,7 @@ sisUpdateHWState( GLcontext *ctx ) } static void -sisDDInvalidateState( GLcontext *ctx, GLuint new_state ) +sisDDInvalidateState( struct gl_context *ctx, GLuint new_state ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -715,7 +715,7 @@ void sisDDInitState( sisContextPtr smesa ) { __GLSiSHardware *current = &smesa->current; __GLSiSHardware *prev = &(smesa->prev); - GLcontext *ctx = smesa->glCtx; + struct gl_context *ctx = smesa->glCtx; /* add Texture Perspective Enable */ prev->hwCapEnable = MASK_FogPerspectiveEnable | MASK_TextureCacheEnable | @@ -826,7 +826,7 @@ void sisDDInitState( sisContextPtr smesa ) /* Initialize the driver's state functions. */ -void sisDDInitStateFuncs( GLcontext *ctx ) +void sisDDInitStateFuncs( struct gl_context *ctx ) { ctx->Driver.UpdateState = sisDDInvalidateState; diff --git a/src/mesa/drivers/dri/sis/sis_state.h b/src/mesa/drivers/dri/sis/sis_state.h index 2d0ea9c5fb..dcade4a979 100644 --- a/src/mesa/drivers/dri/sis/sis_state.h +++ b/src/mesa/drivers/dri/sis/sis_state.h @@ -34,35 +34,35 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "sis_context.h" /* sis6326_clear.c */ -extern void sis6326DDClear( GLcontext *ctx, GLbitfield mask ); -extern void sis6326DDClearColor( GLcontext * ctx, const GLfloat color[4] ); -extern void sis6326DDClearDepth( GLcontext * ctx, GLclampd d ); +extern void sis6326DDClear( struct gl_context *ctx, GLbitfield mask ); +extern void sis6326DDClearColor( struct gl_context * ctx, const GLfloat color[4] ); +extern void sis6326DDClearDepth( struct gl_context * ctx, GLclampd d ); extern void sis6326UpdateZPattern(sisContextPtr smesa, GLclampd z); /* sis_clear.c */ -extern void sisDDClear( GLcontext *ctx, GLbitfield mask ); -extern void sisDDClearColor( GLcontext * ctx, const GLfloat color[4] ); -extern void sisDDClearDepth( GLcontext * ctx, GLclampd d ); -extern void sisDDClearStencil( GLcontext * ctx, GLint s ); +extern void sisDDClear( struct gl_context *ctx, GLbitfield mask ); +extern void sisDDClearColor( struct gl_context * ctx, const GLfloat color[4] ); +extern void sisDDClearDepth( struct gl_context * ctx, GLclampd d ); +extern void sisDDClearStencil( struct gl_context * ctx, GLint s ); extern void sisUpdateZStencilPattern( sisContextPtr smesa, GLclampd z, int stencil ); /* sis_fog.c */ -extern void sisDDFogfv( GLcontext * ctx, GLenum pname, const GLfloat * params ); +extern void sisDDFogfv( struct gl_context * ctx, GLenum pname, const GLfloat * params ); /* sis6326_state.c */ extern void sis6326DDInitState( sisContextPtr smesa ); -extern void sis6326DDInitStateFuncs( GLcontext *ctx ); -extern void sis6326UpdateClipping( GLcontext * gc ); -extern void sis6326DDDrawBuffer( GLcontext *ctx, GLenum mode ); -extern void sis6326UpdateHWState( GLcontext *ctx ); +extern void sis6326DDInitStateFuncs( struct gl_context *ctx ); +extern void sis6326UpdateClipping( struct gl_context * gc ); +extern void sis6326DDDrawBuffer( struct gl_context *ctx, GLenum mode ); +extern void sis6326UpdateHWState( struct gl_context *ctx ); /* sis_state.c */ extern void sisDDInitState( sisContextPtr smesa ); -extern void sisDDInitStateFuncs( GLcontext *ctx ); -extern void sisDDDepthMask( GLcontext * ctx, GLboolean flag ); -extern void sisUpdateClipping( GLcontext * gc ); -extern void sisDDDrawBuffer( GLcontext *ctx, GLenum mode ); -extern void sisUpdateHWState( GLcontext *ctx ); +extern void sisDDInitStateFuncs( struct gl_context *ctx ); +extern void sisDDDepthMask( struct gl_context * ctx, GLboolean flag ); +extern void sisUpdateClipping( struct gl_context * gc ); +extern void sisDDDrawBuffer( struct gl_context *ctx, GLenum mode ); +extern void sisUpdateHWState( struct gl_context *ctx ); #endif diff --git a/src/mesa/drivers/dri/sis/sis_stencil.c b/src/mesa/drivers/dri/sis/sis_stencil.c index 55c0440eba..92eb08f31f 100644 --- a/src/mesa/drivers/dri/sis/sis_stencil.c +++ b/src/mesa/drivers/dri/sis/sis_stencil.c @@ -36,7 +36,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "sis_stencil.h" static void -sisDDStencilFuncSeparate( GLcontext * ctx, GLenum face, +sisDDStencilFuncSeparate( struct gl_context * ctx, GLenum face, GLenum func, GLint ref, GLuint mask ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -85,7 +85,7 @@ sisDDStencilFuncSeparate( GLcontext * ctx, GLenum face, } static void -sisDDStencilMaskSeparate( GLcontext * ctx, GLenum face, GLuint mask ) +sisDDStencilMaskSeparate( struct gl_context * ctx, GLenum face, GLuint mask ) { if (!ctx->Visual.stencilBits) return; @@ -95,7 +95,7 @@ sisDDStencilMaskSeparate( GLcontext * ctx, GLenum face, GLuint mask ) } static void -sisDDStencilOpSeparate( GLcontext * ctx, GLenum face, GLenum fail, +sisDDStencilOpSeparate( struct gl_context * ctx, GLenum face, GLenum fail, GLenum zfail, GLenum zpass ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -197,7 +197,7 @@ sisDDStencilOpSeparate( GLcontext * ctx, GLenum face, GLenum fail, } void -sisDDInitStencilFuncs( GLcontext *ctx ) +sisDDInitStencilFuncs( struct gl_context *ctx ) { ctx->Driver.StencilFuncSeparate = sisDDStencilFuncSeparate; ctx->Driver.StencilMaskSeparate = sisDDStencilMaskSeparate; diff --git a/src/mesa/drivers/dri/sis/sis_stencil.h b/src/mesa/drivers/dri/sis/sis_stencil.h index 6b556c4378..9d061e87fd 100644 --- a/src/mesa/drivers/dri/sis/sis_stencil.h +++ b/src/mesa/drivers/dri/sis/sis_stencil.h @@ -31,6 +31,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef __SIS_STENCIL_H__ #define __SIS_STENCIL_H__ -extern void sisDDInitStencilFuncs( GLcontext *ctx ); +extern void sisDDInitStencilFuncs( struct gl_context *ctx ); #endif diff --git a/src/mesa/drivers/dri/sis/sis_tex.c b/src/mesa/drivers/dri/sis/sis_tex.c index 31709c3af6..bb4896d9bd 100644 --- a/src/mesa/drivers/dri/sis/sis_tex.c +++ b/src/mesa/drivers/dri/sis/sis_tex.c @@ -152,7 +152,7 @@ sisFreeTexImage( sisContextPtr smesa, sisTexObjPtr t, int level ) } static void -sisTexEnv( GLcontext *ctx, GLenum target, GLenum pname, const GLfloat *param ) +sisTexEnv( struct gl_context *ctx, GLenum target, GLenum pname, const GLfloat *param ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -160,7 +160,7 @@ sisTexEnv( GLcontext *ctx, GLenum target, GLenum pname, const GLfloat *param ) } static void -sisTexParameter( GLcontext *ctx, GLenum target, +sisTexParameter( struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj, GLenum pname, const GLfloat *params ) { @@ -170,7 +170,7 @@ sisTexParameter( GLcontext *ctx, GLenum target, } static void -sisBindTexture( GLcontext *ctx, GLenum target, +sisBindTexture( struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -194,7 +194,7 @@ sisBindTexture( GLcontext *ctx, GLenum target, } static void -sisDeleteTexture( GLcontext * ctx, struct gl_texture_object *texObj ) +sisDeleteTexture( struct gl_context * ctx, struct gl_texture_object *texObj ) { sisContextPtr smesa = SIS_CONTEXT(ctx); sisTexObjPtr t; @@ -220,14 +220,14 @@ sisDeleteTexture( GLcontext * ctx, struct gl_texture_object *texObj ) _mesa_delete_texture_object(ctx, texObj); } -static GLboolean sisIsTextureResident( GLcontext * ctx, +static GLboolean sisIsTextureResident( struct gl_context * ctx, struct gl_texture_object *texObj ) { return (texObj->DriverData != NULL); } static gl_format -sisChooseTextureFormat( GLcontext *ctx, GLint internalFormat, +sisChooseTextureFormat( struct gl_context *ctx, GLint internalFormat, GLenum format, GLenum type ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -352,7 +352,7 @@ sisChooseTextureFormat( GLcontext *ctx, GLint internalFormat, } } -static void sisTexImage1D( GLcontext *ctx, GLenum target, GLint level, +static void sisTexImage1D( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -389,7 +389,7 @@ static void sisTexImage1D( GLcontext *ctx, GLenum target, GLint level, } -static void sisTexSubImage1D( GLcontext *ctx, +static void sisTexSubImage1D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, @@ -439,7 +439,7 @@ static void sisTexSubImage1D( GLcontext *ctx, smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING; } -static void sisTexImage2D( GLcontext *ctx, GLenum target, GLint level, +static void sisTexImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -475,7 +475,7 @@ static void sisTexImage2D( GLcontext *ctx, GLenum target, GLint level, smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING; } -static void sisTexSubImage2D( GLcontext *ctx, +static void sisTexSubImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -544,7 +544,7 @@ static void sisTexSubImage2D( GLcontext *ctx, * texture object from the core mesa gl_texture_object. Not done at this time. */ static struct gl_texture_object * -sisNewTextureObject( GLcontext *ctx, GLuint name, GLenum target ) +sisNewTextureObject( struct gl_context *ctx, GLuint name, GLenum target ) { struct gl_texture_object *obj; obj = _mesa_new_texture_object(ctx, name, target); diff --git a/src/mesa/drivers/dri/sis/sis_tex.h b/src/mesa/drivers/dri/sis/sis_tex.h index c499e80e86..f467b7dca9 100644 --- a/src/mesa/drivers/dri/sis/sis_tex.h +++ b/src/mesa/drivers/dri/sis/sis_tex.h @@ -32,6 +32,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define __SIS_TEX_H__ extern void sisInitTextureFuncs( struct dd_function_table *table ); -extern void sisUpdateTextureState( GLcontext *ctx ); +extern void sisUpdateTextureState( struct gl_context *ctx ); #endif /* __SIS_TEX_H__ */ diff --git a/src/mesa/drivers/dri/sis/sis_texstate.c b/src/mesa/drivers/dri/sis/sis_texstate.c index 7b0eebd066..daec239321 100644 --- a/src/mesa/drivers/dri/sis/sis_texstate.c +++ b/src/mesa/drivers/dri/sis/sis_texstate.c @@ -46,7 +46,7 @@ static GLint TransferTexturePitch (GLint dwPitch); /* Handle texenv stuff, called from validate_texture (renderstart) */ static void -sis_set_texture_env0( GLcontext *ctx, struct gl_texture_object *texObj, +sis_set_texture_env0( struct gl_context *ctx, struct gl_texture_object *texObj, int unit ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -182,7 +182,7 @@ sis_set_texture_env0( GLcontext *ctx, struct gl_texture_object *texObj, /* Handle texenv stuff, called from validate_texture (renderstart) */ static void -sis_set_texture_env1( GLcontext *ctx, struct gl_texture_object *texObj, +sis_set_texture_env1( struct gl_context *ctx, struct gl_texture_object *texObj, int unit) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -318,7 +318,7 @@ sis_set_texture_env1( GLcontext *ctx, struct gl_texture_object *texObj, /* Returns 0 if a software fallback is necessary */ static GLboolean -sis_set_texobj_parm( GLcontext *ctx, struct gl_texture_object *texObj, +sis_set_texobj_parm( struct gl_context *ctx, struct gl_texture_object *texObj, int hw_unit ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -583,7 +583,7 @@ sis_set_texobj_parm( GLcontext *ctx, struct gl_texture_object *texObj, /* Disable a texture unit, called from validate_texture */ static void -sis_reset_texture_env (GLcontext *ctx, int hw_unit) +sis_reset_texture_env (struct gl_context *ctx, int hw_unit) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -620,7 +620,7 @@ sis_reset_texture_env (GLcontext *ctx, int hw_unit) } } -static void updateTextureUnit( GLcontext *ctx, int unit ) +static void updateTextureUnit( struct gl_context *ctx, int unit ) { sisContextPtr smesa = SIS_CONTEXT( ctx ); const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; @@ -656,7 +656,7 @@ static void updateTextureUnit( GLcontext *ctx, int unit ) } -void sisUpdateTextureState( GLcontext *ctx ) +void sisUpdateTextureState( struct gl_context *ctx ) { sisContextPtr smesa = SIS_CONTEXT( ctx ); int i; diff --git a/src/mesa/drivers/dri/sis/sis_tris.c b/src/mesa/drivers/dri/sis/sis_tris.c index d109a8c41e..8db593fb9c 100644 --- a/src/mesa/drivers/dri/sis/sis_tris.c +++ b/src/mesa/drivers/dri/sis/sis_tris.c @@ -92,8 +92,8 @@ static const GLuint hw_prim_agp_shade[OP_3D_TRIANGLE_DRAW+1] = { MASK_PsShadingFlatC }; -static void sisRasterPrimitive( GLcontext *ctx, GLuint hwprim ); -static void sisRenderPrimitive( GLcontext *ctx, GLenum prim ); +static void sisRasterPrimitive( struct gl_context *ctx, GLuint hwprim ); +static void sisRenderPrimitive( struct gl_context *ctx, GLenum prim ); /*********************************************************************** * Emit primitives as inline vertices * @@ -556,7 +556,7 @@ sis_fallback_tri( sisContextPtr smesa, sisVertex *v1, sisVertex *v2 ) { - GLcontext *ctx = smesa->glCtx; + struct gl_context *ctx = smesa->glCtx; SWvertex v[3]; _swsetup_Translate( ctx, v0, &v[0] ); _swsetup_Translate( ctx, v1, &v[1] ); @@ -573,7 +573,7 @@ sis_fallback_line( sisContextPtr smesa, sisVertex *v0, sisVertex *v1 ) { - GLcontext *ctx = smesa->glCtx; + struct gl_context *ctx = smesa->glCtx; SWvertex v[2]; _swsetup_Translate( ctx, v0, &v[0] ); _swsetup_Translate( ctx, v1, &v[1] ); @@ -588,7 +588,7 @@ static void sis_fallback_point( sisContextPtr smesa, sisVertex *v0 ) { - GLcontext *ctx = smesa->glCtx; + struct gl_context *ctx = smesa->glCtx; SWvertex v[1]; _swsetup_Translate( ctx, v0, &v[0] ); sisSpanRenderStart( ctx ); @@ -643,7 +643,7 @@ sis_fallback_point( sisContextPtr smesa, #define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED) #define _SIS_NEW_RENDER_STATE (ANY_RASTER_FLAGS | ANY_FALLBACK_FLAGS) -static void sisChooseRenderState(GLcontext *ctx) +static void sisChooseRenderState(struct gl_context *ctx) { TNLcontext *tnl = TNL_CONTEXT(ctx); sisContextPtr smesa = SIS_CONTEXT( ctx ); @@ -701,7 +701,7 @@ static void sisChooseRenderState(GLcontext *ctx) /**********************************************************************/ /* Multipass rendering for front buffering */ /**********************************************************************/ -static GLboolean multipass_cliprect( GLcontext *ctx, GLuint pass ) +static GLboolean multipass_cliprect( struct gl_context *ctx, GLuint pass ) { sisContextPtr smesa = SIS_CONTEXT( ctx ); @@ -743,7 +743,7 @@ static GLboolean multipass_cliprect( GLcontext *ctx, GLuint pass ) /* Validate state at pipeline start */ /**********************************************************************/ -static void sisRunPipeline( GLcontext *ctx ) +static void sisRunPipeline( struct gl_context *ctx ) { sisContextPtr smesa = SIS_CONTEXT( ctx ); @@ -776,7 +776,7 @@ static void sisRunPipeline( GLcontext *ctx ) * and lines, points and bitmaps. */ -static void sisRasterPrimitive( GLcontext *ctx, GLuint hwprim ) +static void sisRasterPrimitive( struct gl_context *ctx, GLuint hwprim ) { sisContextPtr smesa = SIS_CONTEXT(ctx); if (smesa->hw_primitive != hwprim) { @@ -810,7 +810,7 @@ static void sisRasterPrimitive( GLcontext *ctx, GLuint hwprim ) } } -static void sisRenderPrimitive( GLcontext *ctx, GLenum prim ) +static void sisRenderPrimitive( struct gl_context *ctx, GLenum prim ) { sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -836,7 +836,7 @@ do { \ smesa->vertex_attr_count++; \ } while (0) -static void sisRenderStart( GLcontext *ctx ) +static void sisRenderStart( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -927,7 +927,7 @@ static void sisRenderStart( GLcontext *ctx ) } } -static void sisRenderFinish( GLcontext *ctx ) +static void sisRenderFinish( struct gl_context *ctx ) { } @@ -1039,7 +1039,7 @@ static const char *getFallbackString(GLuint bit) return fallbackStrings[i]; } -void sisFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) +void sisFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ) { TNLcontext *tnl = TNL_CONTEXT(ctx); sisContextPtr smesa = SIS_CONTEXT(ctx); @@ -1090,7 +1090,7 @@ void sisFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) /* Initialization. */ /**********************************************************************/ -void sisInitTriFuncs( GLcontext *ctx ) +void sisInitTriFuncs( struct gl_context *ctx ) { sisContextPtr smesa = SIS_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/sis/sis_tris.h b/src/mesa/drivers/dri/sis/sis_tris.h index b34fe8c7c9..d454090607 100644 --- a/src/mesa/drivers/dri/sis/sis_tris.h +++ b/src/mesa/drivers/dri/sis/sis_tris.h @@ -34,10 +34,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "sis_lock.h" #include "main/mtypes.h" -extern void sisInitTriFuncs( GLcontext *ctx ); +extern void sisInitTriFuncs( struct gl_context *ctx ); extern void sisFlushPrims( sisContextPtr smesa ); extern void sisFlushPrimsLocked( sisContextPtr smesa ); -extern void sisFallback( GLcontext *ctx, GLuint bit, GLboolean mode ); +extern void sisFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ); #define FALLBACK( smesa, bit, mode ) sisFallback( smesa->glCtx, bit, mode ) diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index ff53ffd0de..52ba3acf65 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -225,7 +225,7 @@ dri_destroy_screen(__DRIscreen * sPriv) */ static GLuint -choose_pixel_format(const GLvisual *v) +choose_pixel_format(const struct gl_config *v) { int depth = v->rgbBits; @@ -273,7 +273,7 @@ bytes_per_line(unsigned pitch_bits, unsigned mul) } static GLboolean -swrast_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb, +swrast_alloc_front_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb); @@ -290,7 +290,7 @@ swrast_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb, } static GLboolean -swrast_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb, +swrast_alloc_back_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb); @@ -307,7 +307,7 @@ swrast_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb, } static struct swrast_renderbuffer * -swrast_new_renderbuffer(const GLvisual *visual, GLboolean front) +swrast_new_renderbuffer(const struct gl_config *visual, GLboolean front) { struct swrast_renderbuffer *xrb = calloc(1, sizeof *xrb); GLuint pixel_format; @@ -370,10 +370,10 @@ swrast_new_renderbuffer(const GLvisual *visual, GLboolean front) static GLboolean dri_create_buffer(__DRIscreen * sPriv, __DRIdrawable * dPriv, - const __GLcontextModes * visual, GLboolean isPixmap) + const struct gl_config * visual, GLboolean isPixmap) { struct dri_drawable *drawable = NULL; - GLframebuffer *fb; + struct gl_framebuffer *fb; struct swrast_renderbuffer *frontrb, *backrb; TRACE; @@ -432,7 +432,7 @@ dri_destroy_buffer(__DRIdrawable * dPriv) if (dPriv) { struct dri_drawable *drawable = dri_drawable(dPriv); - GLframebuffer *fb; + struct gl_framebuffer *fb; free(drawable->row); @@ -451,7 +451,7 @@ dri_swap_buffers(__DRIdrawable * dPriv) GET_CURRENT_CONTEXT(ctx); struct dri_drawable *drawable = dri_drawable(dPriv); - GLframebuffer *fb; + struct gl_framebuffer *fb; struct swrast_renderbuffer *frontrb, *backrb; TRACE; @@ -487,7 +487,7 @@ dri_swap_buffers(__DRIdrawable * dPriv) */ static void -get_window_size( GLframebuffer *fb, GLsizei *w, GLsizei *h ) +get_window_size( struct gl_framebuffer *fb, GLsizei *w, GLsizei *h ) { __DRIdrawable *dPriv = swrast_drawable(fb)->dPriv; __DRIscreen *sPriv = dPriv->driScreenPriv; @@ -499,7 +499,7 @@ get_window_size( GLframebuffer *fb, GLsizei *w, GLsizei *h ) } static void -swrast_check_and_update_window_size( GLcontext *ctx, GLframebuffer *fb ) +swrast_check_and_update_window_size( struct gl_context *ctx, struct gl_framebuffer *fb ) { GLsizei width, height; @@ -510,7 +510,7 @@ swrast_check_and_update_window_size( GLcontext *ctx, GLframebuffer *fb ) } static const GLubyte * -get_string(GLcontext *ctx, GLenum pname) +get_string(struct gl_context *ctx, GLenum pname) { (void) ctx; switch (pname) { @@ -524,7 +524,7 @@ get_string(GLcontext *ctx, GLenum pname) } static void -update_state( GLcontext *ctx, GLuint new_state ) +update_state( struct gl_context *ctx, GLuint new_state ) { /* not much to do here - pass it on */ _swrast_InvalidateState( ctx, new_state ); @@ -534,16 +534,16 @@ update_state( GLcontext *ctx, GLuint new_state ) } static void -viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) +viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { - GLframebuffer *draw = ctx->WinSysDrawBuffer; - GLframebuffer *read = ctx->WinSysReadBuffer; + struct gl_framebuffer *draw = ctx->WinSysDrawBuffer; + struct gl_framebuffer *read = ctx->WinSysReadBuffer; swrast_check_and_update_window_size(ctx, draw); swrast_check_and_update_window_size(ctx, read); } -static gl_format swrastChooseTextureFormat(GLcontext * ctx, +static gl_format swrastChooseTextureFormat(struct gl_context * ctx, GLint internalFormat, GLenum format, GLenum type) @@ -570,13 +570,13 @@ swrast_init_driver_functions(struct dd_function_table *driver) static GLboolean dri_create_context(gl_api api, - const __GLcontextModes * visual, + const struct gl_config * visual, __DRIcontext * cPriv, void *sharedContextPrivate) { struct dri_context *ctx = NULL; struct dri_context *share = (struct dri_context *)sharedContextPrivate; - GLcontext *mesaCtx = NULL; - GLcontext *sharedCtx = NULL; + struct gl_context *mesaCtx = NULL; + struct gl_context *sharedCtx = NULL; struct dd_function_table functions; TRACE; @@ -646,7 +646,7 @@ dri_destroy_context(__DRIcontext * cPriv) if (cPriv) { struct dri_context *ctx = dri_context(cPriv); - GLcontext *mesaCtx; + struct gl_context *mesaCtx; mesaCtx = &ctx->Base; @@ -664,9 +664,9 @@ dri_make_current(__DRIcontext * cPriv, __DRIdrawable * driDrawPriv, __DRIdrawable * driReadPriv) { - GLcontext *mesaCtx; - GLframebuffer *mesaDraw; - GLframebuffer *mesaRead; + struct gl_context *mesaCtx; + struct gl_framebuffer *mesaDraw; + struct gl_framebuffer *mesaRead; TRACE; if (cPriv) { diff --git a/src/mesa/drivers/dri/swrast/swrast_priv.h b/src/mesa/drivers/dri/swrast/swrast_priv.h index 6679061a98..bdb52ef26f 100644 --- a/src/mesa/drivers/dri/swrast/swrast_priv.h +++ b/src/mesa/drivers/dri/swrast/swrast_priv.h @@ -58,7 +58,7 @@ struct dri_context { /* mesa, base class, must be first */ - GLcontext Base; + struct gl_context Base; /* dri */ __DRIcontext *cPriv; @@ -71,7 +71,7 @@ dri_context(__DRIcontext * driContextPriv) } static INLINE struct dri_context * -swrast_context(GLcontext *ctx) +swrast_context(struct gl_context *ctx) { return (struct dri_context *) ctx; } @@ -79,7 +79,7 @@ swrast_context(GLcontext *ctx) struct dri_drawable { /* mesa, base class, must be first */ - GLframebuffer Base; + struct gl_framebuffer Base; /* dri */ __DRIdrawable *dPriv; @@ -95,7 +95,7 @@ dri_drawable(__DRIdrawable * driDrawPriv) } static INLINE struct dri_drawable * -swrast_drawable(GLframebuffer *fb) +swrast_drawable(struct gl_framebuffer *fb) { return (struct dri_drawable *) fb; } diff --git a/src/mesa/drivers/dri/swrast/swrast_spantemp.h b/src/mesa/drivers/dri/swrast/swrast_spantemp.h index 1e9405eebf..69f8d9f240 100644 --- a/src/mesa/drivers/dri/swrast/swrast_spantemp.h +++ b/src/mesa/drivers/dri/swrast/swrast_spantemp.h @@ -37,7 +37,7 @@ #define _SWRAST_SPANTEMP_ONCE static INLINE void -PUT_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLvoid *p ) +PUT_PIXEL( struct gl_context *glCtx, GLint x, GLint y, GLvoid *p ) { __DRIcontext *ctx = swrast_context(glCtx)->cPriv; __DRIdrawable *draw = swrast_drawable(glCtx->DrawBuffer)->dPriv; @@ -51,7 +51,7 @@ PUT_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLvoid *p ) static INLINE void -GET_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLubyte *p ) +GET_PIXEL( struct gl_context *glCtx, GLint x, GLint y, GLubyte *p ) { __DRIcontext *ctx = swrast_context(glCtx)->cPriv; __DRIdrawable *read = swrast_drawable(glCtx->ReadBuffer)->dPriv; @@ -63,7 +63,7 @@ GET_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLubyte *p ) } static INLINE void -PUT_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row ) +PUT_ROW( struct gl_context *glCtx, GLint x, GLint y, GLuint n, char *row ) { __DRIcontext *ctx = swrast_context(glCtx)->cPriv; __DRIdrawable *draw = swrast_drawable(glCtx->DrawBuffer)->dPriv; @@ -76,7 +76,7 @@ PUT_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row ) } static INLINE void -GET_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row ) +GET_ROW( struct gl_context *glCtx, GLint x, GLint y, GLuint n, char *row ) { __DRIcontext *ctx = swrast_context(glCtx)->cPriv; __DRIdrawable *read = swrast_drawable(glCtx->ReadBuffer)->dPriv; @@ -118,7 +118,7 @@ GET_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row ) static void -NAME(get_row)( GLcontext *ctx, struct gl_renderbuffer *rb, +NAME(get_row)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, void *values ) { #ifdef SPAN_VARS @@ -138,7 +138,7 @@ NAME(get_row)( GLcontext *ctx, struct gl_renderbuffer *rb, static void -NAME(get_values)( GLcontext *ctx, struct gl_renderbuffer *rb, +NAME(get_values)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], void *values ) { #ifdef SPAN_VARS @@ -156,7 +156,7 @@ NAME(get_values)( GLcontext *ctx, struct gl_renderbuffer *rb, static void -NAME(put_row)( GLcontext *ctx, struct gl_renderbuffer *rb, +NAME(put_row)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte mask[] ) { @@ -189,7 +189,7 @@ NAME(put_row)( GLcontext *ctx, struct gl_renderbuffer *rb, static void -NAME(put_row_rgb)( GLcontext *ctx, struct gl_renderbuffer *rb, +NAME(put_row_rgb)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte mask[] ) { @@ -230,7 +230,7 @@ NAME(put_row_rgb)( GLcontext *ctx, struct gl_renderbuffer *rb, static void -NAME(put_mono_row)( GLcontext *ctx, struct gl_renderbuffer *rb, +NAME(put_mono_row)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *value, const GLubyte mask[] ) { @@ -263,7 +263,7 @@ NAME(put_mono_row)( GLcontext *ctx, struct gl_renderbuffer *rb, static void -NAME(put_values)( GLcontext *ctx, struct gl_renderbuffer *rb, +NAME(put_values)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *values, const GLubyte mask[] ) { @@ -286,7 +286,7 @@ NAME(put_values)( GLcontext *ctx, struct gl_renderbuffer *rb, static void -NAME(put_mono_values)( GLcontext *ctx, struct gl_renderbuffer *rb, +NAME(put_mono_values)( struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *value, const GLubyte mask[] ) { diff --git a/src/mesa/drivers/dri/tdfx/tdfx_context.c b/src/mesa/drivers/dri/tdfx/tdfx_context.c index c30fcf3a6f..63dfa5ae74 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_context.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_context.c @@ -124,7 +124,7 @@ static const struct dri_extension napalm_extensions[] = /* * Enable/Disable the extensions for this context. */ -static void tdfxDDInitExtensions( GLcontext *ctx ) +static void tdfxDDInitExtensions( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -136,8 +136,6 @@ static void tdfxDDInitExtensions( GLcontext *ctx ) if ( TDFX_IS_NAPALM( fxMesa ) ) { driInitExtensions( ctx, napalm_extensions, GL_FALSE ); - } else { - _mesa_enable_extension( ctx, "GL_SGIS_generate_mipmap" ); } } @@ -165,12 +163,12 @@ static const struct dri_debug_control debug_control[] = }; GLboolean tdfxCreateContext( gl_api api, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, __DRIcontext *driContextPriv, void *sharedContextPrivate ) { tdfxContextPtr fxMesa; - GLcontext *ctx, *shareCtx; + struct gl_context *ctx, *shareCtx; __DRIscreen *sPriv = driContextPriv->driScreenPriv; tdfxScreenPrivate *fxScreen = (tdfxScreenPrivate *) sPriv->private; TDFXSAREAPriv *saPriv = (TDFXSAREAPriv *) ((char *) sPriv->pSAREA + @@ -637,7 +635,7 @@ tdfxMakeCurrent( __DRIcontext *driContextPriv, if ( driContextPriv ) { tdfxContextPtr newFx = (tdfxContextPtr) driContextPriv->driverPrivate; - GLcontext *newCtx = newFx->glCtx; + struct gl_context *newCtx = newFx->glCtx; GET_CURRENT_CONTEXT(curCtx); if ((newFx->driDrawable != driDrawPriv) @@ -653,8 +651,8 @@ tdfxMakeCurrent( __DRIcontext *driContextPriv, * dispatch is set correctly. */ _mesa_make_current( newCtx, - (GLframebuffer *) driDrawPriv->driverPrivate, - (GLframebuffer *) driReadPriv->driverPrivate ); + (struct gl_framebuffer *) driDrawPriv->driverPrivate, + (struct gl_framebuffer *) driReadPriv->driverPrivate ); return GL_TRUE; } /* [dBorca] tunnel2 requires this */ @@ -691,8 +689,8 @@ tdfxMakeCurrent( __DRIcontext *driContextPriv, } _mesa_make_current( newCtx, - (GLframebuffer *) driDrawPriv->driverPrivate, - (GLframebuffer *) driReadPriv->driverPrivate ); + (struct gl_framebuffer *) driDrawPriv->driverPrivate, + (struct gl_framebuffer *) driReadPriv->driverPrivate ); } else { _mesa_make_current( NULL, NULL, NULL ); } diff --git a/src/mesa/drivers/dri/tdfx/tdfx_context.h b/src/mesa/drivers/dri/tdfx/tdfx_context.h index 29b0876f9f..fb38419dcd 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_context.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_context.h @@ -810,7 +810,7 @@ typedef void (*tdfx_point_func)( tdfxContextPtr, tdfxVertex * ); struct tdfx_context { /* Set once and never changed: */ - GLcontext *glCtx; /* The core Mesa context */ + struct gl_context *glCtx; /* The core Mesa context */ GLuint new_gl_state; GLuint new_state; @@ -938,7 +938,7 @@ struct tdfx_context { extern GLboolean tdfxCreateContext( gl_api api, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, __DRIcontext *driContextPriv, void *sharedContextPrivate ); @@ -957,10 +957,10 @@ extern GLboolean tdfxInitGlide( tdfxContextPtr tmesa ); extern void -FX_grColorMaskv(GLcontext *ctx, const GLboolean rgba[4]); +FX_grColorMaskv(struct gl_context *ctx, const GLboolean rgba[4]); extern void -FX_grColorMaskv_NoLock(GLcontext *ctx, const GLboolean rgba[4]); +FX_grColorMaskv_NoLock(struct gl_context *ctx, const GLboolean rgba[4]); /* Color packing utilities diff --git a/src/mesa/drivers/dri/tdfx/tdfx_dd.c b/src/mesa/drivers/dri/tdfx/tdfx_dd.c index 2cbbeb8114..d60931ad7f 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_dd.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_dd.c @@ -54,7 +54,7 @@ const GLboolean true4[4] = { GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE }; * checks for this rather than doing a glGet(GL_MAX_TEXTURE_SIZE). * Why? */ -static const GLubyte *tdfxDDGetString( GLcontext *ctx, GLenum name ) +static const GLubyte *tdfxDDGetString( struct gl_context *ctx, GLenum name ) { tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx; @@ -103,7 +103,7 @@ static const GLubyte *tdfxDDGetString( GLcontext *ctx, GLenum name ) static void -tdfxBeginQuery(GLcontext *ctx, struct gl_query_object *q) +tdfxBeginQuery(struct gl_context *ctx, struct gl_query_object *q) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -119,7 +119,7 @@ tdfxBeginQuery(GLcontext *ctx, struct gl_query_object *q) static void -tdfxEndQuery(GLcontext *ctx, struct gl_query_object *q) +tdfxEndQuery(struct gl_context *ctx, struct gl_query_object *q) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); FxI32 total_pixels; @@ -157,7 +157,7 @@ tdfxEndQuery(GLcontext *ctx, struct gl_query_object *q) (vis->blueBits == b) && \ (vis->alphaBits == a)) -void tdfxDDInitDriverFuncs( const __GLcontextModes *visual, +void tdfxDDInitDriverFuncs( const struct gl_config *visual, struct dd_function_table *functions ) { if ( MESA_VERBOSE & VERBOSE_DRIVER ) { @@ -187,7 +187,7 @@ void tdfxDDInitDriverFuncs( const __GLcontextModes *visual, */ void -FX_grColorMaskv(GLcontext *ctx, const GLboolean rgba[4]) +FX_grColorMaskv(struct gl_context *ctx, const GLboolean rgba[4]) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); LOCK_HARDWARE(fxMesa); @@ -207,7 +207,7 @@ FX_grColorMaskv(GLcontext *ctx, const GLboolean rgba[4]) } void -FX_grColorMaskv_NoLock(GLcontext *ctx, const GLboolean rgba[4]) +FX_grColorMaskv_NoLock(struct gl_context *ctx, const GLboolean rgba[4]) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); if (ctx->Visual.redBits == 8) { diff --git a/src/mesa/drivers/dri/tdfx/tdfx_dd.h b/src/mesa/drivers/dri/tdfx/tdfx_dd.h index f419c8426a..d68e1ece1b 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_dd.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_dd.h @@ -38,7 +38,7 @@ #include "main/context.h" -extern void tdfxDDInitDriverFuncs( const __GLcontextModes *visual, +extern void tdfxDDInitDriverFuncs( const struct gl_config *visual, struct dd_function_table *functions ); #endif diff --git a/src/mesa/drivers/dri/tdfx/tdfx_pixels.c b/src/mesa/drivers/dri/tdfx/tdfx_pixels.c index 5a7184056d..bbbd0d5740 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_pixels.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_pixels.c @@ -153,7 +153,7 @@ inClipRects_Region(tdfxContextPtr fxMesa, int x, int y, int width, int height) #if 0 GLboolean -tdfx_bitmap_R5G6B5(GLcontext * ctx, GLint px, GLint py, +tdfx_bitmap_R5G6B5(struct gl_context * ctx, GLint px, GLint py, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte * bitmap) @@ -317,7 +317,7 @@ tdfx_bitmap_R5G6B5(GLcontext * ctx, GLint px, GLint py, #if 0 GLboolean -tdfx_bitmap_R8G8B8A8(GLcontext * ctx, GLint px, GLint py, +tdfx_bitmap_R8G8B8A8(struct gl_context * ctx, GLint px, GLint py, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte * bitmap) @@ -475,7 +475,7 @@ tdfx_bitmap_R8G8B8A8(GLcontext * ctx, GLint px, GLint py, #endif void -tdfx_readpixels_R5G6B5(GLcontext * ctx, GLint x, GLint y, +tdfx_readpixels_R5G6B5(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *packing, @@ -532,7 +532,7 @@ tdfx_readpixels_R5G6B5(GLcontext * ctx, GLint x, GLint y, } void -tdfx_readpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y, +tdfx_readpixels_R8G8B8A8(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *packing, @@ -591,7 +591,7 @@ tdfx_readpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y, } void -tdfx_drawpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y, +tdfx_drawpixels_R8G8B8A8(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, diff --git a/src/mesa/drivers/dri/tdfx/tdfx_pixels.h b/src/mesa/drivers/dri/tdfx/tdfx_pixels.h index f5e5427653..f4cc20fd62 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_pixels.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_pixels.h @@ -41,33 +41,33 @@ #include "main/context.h" extern void -tdfx_bitmap_R5G6B5( GLcontext *ctx, GLint px, GLint py, +tdfx_bitmap_R5G6B5( struct gl_context *ctx, GLint px, GLint py, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap ); extern void -tdfx_bitmap_R8G8B8A8( GLcontext *ctx, GLint px, GLint py, +tdfx_bitmap_R8G8B8A8( struct gl_context *ctx, GLint px, GLint py, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap ); extern void -tdfx_readpixels_R5G6B5( GLcontext *ctx, GLint x, GLint y, +tdfx_readpixels_R5G6B5( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *packing, GLvoid *dstImage ); extern void -tdfx_readpixels_R8G8B8A8( GLcontext *ctx, GLint x, GLint y, +tdfx_readpixels_R8G8B8A8( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *packing, GLvoid *dstImage ); extern void -tdfx_drawpixels_R8G8B8A8( GLcontext *ctx, GLint x, GLint y, +tdfx_drawpixels_R8G8B8A8( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, diff --git a/src/mesa/drivers/dri/tdfx/tdfx_render.c b/src/mesa/drivers/dri/tdfx/tdfx_render.c index 979bcd4514..f083756787 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_render.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_render.c @@ -45,7 +45,7 @@ /* Clear the color and/or depth buffers. */ -static void tdfxClear( GLcontext *ctx, GLbitfield mask ) +static void tdfxClear( struct gl_context *ctx, GLbitfield mask ) { tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx; GLbitfield softwareMask = mask & (BUFFER_BIT_ACCUM); @@ -314,7 +314,7 @@ static void tdfxClear( GLcontext *ctx, GLbitfield mask ) -static void tdfxFinish( GLcontext *ctx ) +static void tdfxFinish( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -325,7 +325,7 @@ static void tdfxFinish( GLcontext *ctx ) UNLOCK_HARDWARE( fxMesa ); } -static void tdfxFlush( GLcontext *ctx ) +static void tdfxFlush( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -528,7 +528,7 @@ static void uploadTextureSource( tdfxContextPtr fxMesa ) static void uploadTextureImages( tdfxContextPtr fxMesa ) { - GLcontext *ctx = fxMesa->glCtx; + struct gl_context *ctx = fxMesa->glCtx; int unit; for (unit = 0; unit < TDFX_NUM_TMU; unit++) { if (ctx->Texture.Unit[unit]._ReallyEnabled & (TEXTURE_1D_BIT|TEXTURE_2D_BIT)) { diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index 26de09503a..084560ff87 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -155,7 +155,7 @@ tdfxInitDriver( __DRIscreen *sPriv ) static GLboolean tdfxCreateBuffer( __DRIscreen *driScrnPriv, __DRIdrawable *driDrawPriv, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, GLboolean isPixmap ) { tdfxScreenPrivate *screen = (tdfxScreenPrivate *) driScrnPriv->private; @@ -227,7 +227,7 @@ tdfxCreateBuffer( __DRIscreen *driScrnPriv, static void tdfxDestroyBuffer(__DRIdrawable *driDrawPriv) { - _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL); + _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL); } @@ -237,13 +237,13 @@ tdfxSwapBuffers( __DRIdrawable *driDrawPriv ) { GET_CURRENT_CONTEXT(ctx); tdfxContextPtr fxMesa = 0; - GLframebuffer *mesaBuffer; + struct gl_framebuffer *mesaBuffer; if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { fprintf( stderr, "%s( %p )\n", __FUNCTION__, (void *)driDrawPriv ); } - mesaBuffer = (GLframebuffer *) driDrawPriv->driverPrivate; + mesaBuffer = (struct gl_framebuffer *) driDrawPriv->driverPrivate; if ( !mesaBuffer->Visual.doubleBufferMode ) return; /* can't swap a single-buffered window */ @@ -394,7 +394,7 @@ tdfxFillInModes(__DRIscreen *psp, * * \todo maybe fold this into intelInitDriver * - * \return the __GLcontextModes supported by this driver + * \return the struct gl_config supported by this driver */ static const __DRIconfig ** tdfxInitScreen(__DRIscreen *psp) diff --git a/src/mesa/drivers/dri/tdfx/tdfx_span.c b/src/mesa/drivers/dri/tdfx/tdfx_span.c index 3879d506ee..12524e2316 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_span.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_span.c @@ -582,7 +582,7 @@ GetFbParams(tdfxContextPtr fxMesa, static void -tdfxDDWriteDepthSpan(GLcontext * ctx, struct gl_renderbuffer *rb, +tdfxDDWriteDepthSpan(struct gl_context * ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *values, const GLubyte mask[]) { @@ -819,7 +819,7 @@ tdfxDDWriteDepthSpan(GLcontext * ctx, struct gl_renderbuffer *rb, } static void -tdfxDDWriteMonoDepthSpan(GLcontext * ctx, struct gl_renderbuffer *rb, +tdfxDDWriteMonoDepthSpan(struct gl_context * ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *value, const GLubyte mask[]) { @@ -833,7 +833,7 @@ tdfxDDWriteMonoDepthSpan(GLcontext * ctx, struct gl_renderbuffer *rb, static void -tdfxDDReadDepthSpan(GLcontext * ctx, struct gl_renderbuffer *rb, +tdfxDDReadDepthSpan(struct gl_context * ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, void *values) { GLuint *depth = (GLuint *) values; @@ -937,7 +937,7 @@ tdfxDDReadDepthSpan(GLcontext * ctx, struct gl_renderbuffer *rb, static void -tdfxDDWriteDepthPixels(GLcontext * ctx, struct gl_renderbuffer *rb, +tdfxDDWriteDepthPixels(struct gl_context * ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], const void *values, const GLubyte mask[]) { @@ -1020,7 +1020,7 @@ tdfxDDWriteDepthPixels(GLcontext * ctx, struct gl_renderbuffer *rb, static void -tdfxDDReadDepthPixels(GLcontext * ctx, struct gl_renderbuffer *rb, GLuint n, +tdfxDDReadDepthPixels(struct gl_context * ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], void *values) { GLuint *depth = (GLuint *) values; @@ -1107,7 +1107,7 @@ tdfxDDReadDepthPixels(GLcontext * ctx, struct gl_renderbuffer *rb, GLuint n, #define BUILD_ZS(z, s) (((s) << 24) | (z)) static void -write_stencil_span(GLcontext * ctx, struct gl_renderbuffer *rb, +write_stencil_span(struct gl_context * ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *values, const GLubyte mask[]) { @@ -1166,7 +1166,7 @@ write_stencil_span(GLcontext * ctx, struct gl_renderbuffer *rb, static void -write_mono_stencil_span(GLcontext * ctx, struct gl_renderbuffer *rb, +write_mono_stencil_span(struct gl_context * ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const void *value, const GLubyte mask[]) { @@ -1180,7 +1180,7 @@ write_mono_stencil_span(GLcontext * ctx, struct gl_renderbuffer *rb, static void -read_stencil_span(GLcontext * ctx, struct gl_renderbuffer *rb, +read_stencil_span(struct gl_context * ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, void *values) { @@ -1232,7 +1232,7 @@ read_stencil_span(GLcontext * ctx, struct gl_renderbuffer *rb, static void -write_stencil_pixels(GLcontext * ctx, struct gl_renderbuffer *rb, +write_stencil_pixels(struct gl_context * ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], const void *values, const GLubyte mask[]) { @@ -1271,7 +1271,7 @@ write_stencil_pixels(GLcontext * ctx, struct gl_renderbuffer *rb, static void -read_stencil_pixels(GLcontext * ctx, struct gl_renderbuffer *rb, +read_stencil_pixels(struct gl_context * ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], void *values) { @@ -1318,13 +1318,13 @@ read_stencil_pixels(GLcontext * ctx, struct gl_renderbuffer *rb, /**********************************************************************/ -static void tdfxSpanRenderStart( GLcontext *ctx ) +static void tdfxSpanRenderStart( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); LOCK_HARDWARE(fxMesa); } -static void tdfxSpanRenderFinish( GLcontext *ctx ) +static void tdfxSpanRenderFinish( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); _swrast_flush( ctx ); @@ -1335,7 +1335,7 @@ static void tdfxSpanRenderFinish( GLcontext *ctx ) /* Initialize swrast device driver */ /**********************************************************************/ -void tdfxDDInitSpanFuncs( GLcontext *ctx ) +void tdfxDDInitSpanFuncs( struct gl_context *ctx ) { struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx ); swdd->SpanRenderStart = tdfxSpanRenderStart; @@ -1348,7 +1348,7 @@ void tdfxDDInitSpanFuncs( GLcontext *ctx ) * Plug in the Get/Put routines for the given driRenderbuffer. */ void -tdfxSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis) +tdfxSetSpanFunctions(driRenderbuffer *drb, const struct gl_config *vis) { if (drb->Base.InternalFormat == GL_RGBA) { if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) { diff --git a/src/mesa/drivers/dri/tdfx/tdfx_span.h b/src/mesa/drivers/dri/tdfx/tdfx_span.h index 6973f8d140..ae3d074a58 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_span.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_span.h @@ -40,9 +40,9 @@ #include "main/context.h" #include "drirenderbuffer.h" -extern void tdfxDDInitSpanFuncs( GLcontext *ctx ); +extern void tdfxDDInitSpanFuncs( struct gl_context *ctx ); extern void -tdfxSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis); +tdfxSetSpanFunctions(driRenderbuffer *rb, const struct gl_config *vis); #endif diff --git a/src/mesa/drivers/dri/tdfx/tdfx_state.c b/src/mesa/drivers/dri/tdfx/tdfx_state.c index dcbc7647f2..3f6822d457 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_state.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_state.c @@ -60,7 +60,7 @@ * Alpha blending */ -static void tdfxUpdateAlphaMode( GLcontext *ctx ) +static void tdfxUpdateAlphaMode( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); GrCmpFnc_t func; @@ -283,7 +283,7 @@ static void tdfxUpdateAlphaMode( GLcontext *ctx ) } } -static void tdfxDDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) +static void tdfxDDAlphaFunc( struct gl_context *ctx, GLenum func, GLfloat ref ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); @@ -291,7 +291,7 @@ static void tdfxDDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) fxMesa->new_state |= TDFX_NEW_ALPHA; } -static void tdfxDDBlendEquationSeparate( GLcontext *ctx, +static void tdfxDDBlendEquationSeparate( struct gl_context *ctx, GLenum modeRGB, GLenum modeA ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); @@ -301,7 +301,7 @@ static void tdfxDDBlendEquationSeparate( GLcontext *ctx, fxMesa->new_state |= TDFX_NEW_ALPHA; } -static void tdfxDDBlendFuncSeparate( GLcontext *ctx, +static void tdfxDDBlendFuncSeparate( struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) { @@ -321,7 +321,7 @@ static void tdfxDDBlendFuncSeparate( GLcontext *ctx, * Stipple */ -void tdfxUpdateStipple( GLcontext *ctx ) +void tdfxUpdateStipple( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); GrStippleMode_t mode = GR_STIPPLE_DISABLE; @@ -347,7 +347,7 @@ void tdfxUpdateStipple( GLcontext *ctx ) * Depth testing */ -static void tdfxUpdateZMode( GLcontext *ctx ) +static void tdfxUpdateZMode( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); GrCmpFnc_t func; @@ -386,7 +386,7 @@ static void tdfxUpdateZMode( GLcontext *ctx ) } } -static void tdfxDDDepthFunc( GLcontext *ctx, GLenum func ) +static void tdfxDDDepthFunc( struct gl_context *ctx, GLenum func ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); @@ -394,7 +394,7 @@ static void tdfxDDDepthFunc( GLcontext *ctx, GLenum func ) fxMesa->new_state |= TDFX_NEW_DEPTH; } -static void tdfxDDDepthMask( GLcontext *ctx, GLboolean flag ) +static void tdfxDDDepthMask( struct gl_context *ctx, GLboolean flag ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); @@ -402,7 +402,7 @@ static void tdfxDDDepthMask( GLcontext *ctx, GLboolean flag ) fxMesa->new_state |= TDFX_NEW_DEPTH; } -static void tdfxDDClearDepth( GLcontext *ctx, GLclampd d ) +static void tdfxDDClearDepth( struct gl_context *ctx, GLclampd d ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); @@ -445,7 +445,7 @@ static GrStencil_t convertGLStencilOp( GLenum op ) } -static void tdfxUpdateStencil( GLcontext *ctx ) +static void tdfxUpdateStencil( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -470,7 +470,7 @@ static void tdfxUpdateStencil( GLcontext *ctx ) static void -tdfxDDStencilFuncSeparate( GLcontext *ctx, GLenum face, GLenum func, +tdfxDDStencilFuncSeparate( struct gl_context *ctx, GLenum face, GLenum func, GLint ref, GLuint mask ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -480,7 +480,7 @@ tdfxDDStencilFuncSeparate( GLcontext *ctx, GLenum face, GLenum func, } static void -tdfxDDStencilMaskSeparate( GLcontext *ctx, GLenum face, GLuint mask ) +tdfxDDStencilMaskSeparate( struct gl_context *ctx, GLenum face, GLuint mask ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -489,7 +489,7 @@ tdfxDDStencilMaskSeparate( GLcontext *ctx, GLenum face, GLuint mask ) } static void -tdfxDDStencilOpSeparate( GLcontext *ctx, GLenum face, GLenum sfail, +tdfxDDStencilOpSeparate( struct gl_context *ctx, GLenum face, GLenum sfail, GLenum zfail, GLenum zpass ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -503,7 +503,7 @@ tdfxDDStencilOpSeparate( GLcontext *ctx, GLenum face, GLenum sfail, * Fog - orthographic fog still not working */ -static void tdfxUpdateFogAttrib( GLcontext *ctx ) +static void tdfxUpdateFogAttrib( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); GrFogMode_t mode; @@ -562,7 +562,7 @@ static void tdfxUpdateFogAttrib( GLcontext *ctx ) } } -static void tdfxDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) +static void tdfxDDFogfv( struct gl_context *ctx, GLenum pname, const GLfloat *param ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -614,7 +614,7 @@ static int intersect_rect( drm_clip_rect_t *out, * Examine XF86 cliprect list and scissor state to recompute our * cliprect list. */ -void tdfxUpdateClipping( GLcontext *ctx ) +void tdfxUpdateClipping( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); __DRIdrawable *dPriv = fxMesa->driDrawable; @@ -695,7 +695,7 @@ void tdfxUpdateClipping( GLcontext *ctx ) * Culling */ -void tdfxUpdateCull( GLcontext *ctx ) +void tdfxUpdateCull( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); GrCullMode_t mode = GR_CULL_DISABLE; @@ -737,7 +737,7 @@ void tdfxUpdateCull( GLcontext *ctx ) } } -static void tdfxDDCullFace( GLcontext *ctx, GLenum mode ) +static void tdfxDDCullFace( struct gl_context *ctx, GLenum mode ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); @@ -745,7 +745,7 @@ static void tdfxDDCullFace( GLcontext *ctx, GLenum mode ) fxMesa->new_state |= TDFX_NEW_CULL; } -static void tdfxDDFrontFace( GLcontext *ctx, GLenum mode ) +static void tdfxDDFrontFace( struct gl_context *ctx, GLenum mode ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); @@ -758,7 +758,7 @@ static void tdfxDDFrontFace( GLcontext *ctx, GLenum mode ) * Line drawing. */ -static void tdfxUpdateLine( GLcontext *ctx ) +static void tdfxUpdateLine( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); @@ -771,7 +771,7 @@ static void tdfxUpdateLine( GLcontext *ctx ) } -static void tdfxDDLineWidth( GLcontext *ctx, GLfloat width ) +static void tdfxDDLineWidth( struct gl_context *ctx, GLfloat width ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); FLUSH_BATCH( fxMesa ); @@ -783,7 +783,7 @@ static void tdfxDDLineWidth( GLcontext *ctx, GLfloat width ) * Color Attributes */ -static void tdfxDDColorMask( GLcontext *ctx, +static void tdfxDDColorMask( struct gl_context *ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) { @@ -810,7 +810,7 @@ static void tdfxDDColorMask( GLcontext *ctx, } -static void tdfxDDClearColor( GLcontext *ctx, +static void tdfxDDClearColor( struct gl_context *ctx, const GLfloat color[4] ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -829,7 +829,7 @@ static void tdfxDDClearColor( GLcontext *ctx, * Light Model */ -static void tdfxDDLightModelfv( GLcontext *ctx, GLenum pname, +static void tdfxDDLightModelfv( struct gl_context *ctx, GLenum pname, const GLfloat *param ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -841,7 +841,7 @@ static void tdfxDDLightModelfv( GLcontext *ctx, GLenum pname, } } -static void tdfxDDShadeModel( GLcontext *ctx, GLenum mode ) +static void tdfxDDShadeModel( struct gl_context *ctx, GLenum mode ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -856,7 +856,7 @@ static void tdfxDDShadeModel( GLcontext *ctx, GLenum mode ) */ static void -tdfxDDScissor(GLcontext * ctx, GLint x, GLint y, GLsizei w, GLsizei h) +tdfxDDScissor(struct gl_context * ctx, GLint x, GLint y, GLsizei w, GLsizei h) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); FLUSH_BATCH( fxMesa ); @@ -867,7 +867,7 @@ tdfxDDScissor(GLcontext * ctx, GLint x, GLint y, GLsizei w, GLsizei h) * Render */ -static void tdfxUpdateRenderAttrib( GLcontext *ctx ) +static void tdfxUpdateRenderAttrib( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); FLUSH_BATCH( fxMesa ); @@ -878,7 +878,7 @@ static void tdfxUpdateRenderAttrib( GLcontext *ctx ) * Viewport */ -void tdfxUpdateViewport( GLcontext *ctx ) +void tdfxUpdateViewport( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); const GLfloat *v = ctx->Viewport._WindowMap.m; @@ -895,7 +895,7 @@ void tdfxUpdateViewport( GLcontext *ctx ) } -static void tdfxDDViewport( GLcontext *ctx, GLint x, GLint y, +static void tdfxDDViewport( struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -904,7 +904,7 @@ static void tdfxDDViewport( GLcontext *ctx, GLint x, GLint y, } -static void tdfxDDDepthRange( GLcontext *ctx, GLclampd nearVal, GLclampd farVal ) +static void tdfxDDDepthRange( struct gl_context *ctx, GLclampd nearVal, GLclampd farVal ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); FLUSH_BATCH( fxMesa ); @@ -916,7 +916,7 @@ static void tdfxDDDepthRange( GLcontext *ctx, GLclampd nearVal, GLclampd farVal * State enable/disable */ -static void tdfxDDEnable( GLcontext *ctx, GLenum cap, GLboolean state ) +static void tdfxDDEnable( struct gl_context *ctx, GLenum cap, GLboolean state ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); @@ -1017,7 +1017,7 @@ static void tdfxDDEnable( GLcontext *ctx, GLenum cap, GLboolean state ) /* Set the buffer used for drawing */ /* XXX support for separate read/draw buffers hasn't been tested */ -static void tdfxDDDrawBuffer( GLcontext *ctx, GLenum mode ) +static void tdfxDDDrawBuffer( struct gl_context *ctx, GLenum mode ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -1054,7 +1054,7 @@ static void tdfxDDDrawBuffer( GLcontext *ctx, GLenum mode ) } -static void tdfxDDReadBuffer( GLcontext *ctx, GLenum mode ) +static void tdfxDDReadBuffer( struct gl_context *ctx, GLenum mode ) { /* XXX ??? */ } @@ -1064,7 +1064,7 @@ static void tdfxDDReadBuffer( GLcontext *ctx, GLenum mode ) * Polygon stipple */ -static void tdfxDDPolygonStipple( GLcontext *ctx, const GLubyte *mask ) +static void tdfxDDPolygonStipple( struct gl_context *ctx, const GLubyte *mask ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); const GLubyte *m = mask; @@ -1119,7 +1119,7 @@ static void tdfxDDPolygonStipple( GLcontext *ctx, const GLubyte *mask ) -static void tdfxDDRenderMode( GLcontext *ctx, GLenum mode ) +static void tdfxDDRenderMode( struct gl_context *ctx, GLenum mode ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); FALLBACK( fxMesa, TDFX_FALLBACK_RENDER_MODE, (mode != GL_RENDER) ); @@ -1150,7 +1150,7 @@ static void tdfxDDPrintState( const char *msg, GLuint flags ) -void tdfxDDUpdateHwState( GLcontext *ctx ) +void tdfxDDUpdateHwState( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); int new_state = fxMesa->new_state; @@ -1226,7 +1226,7 @@ void tdfxDDUpdateHwState( GLcontext *ctx ) } -static void tdfxDDInvalidateState( GLcontext *ctx, GLuint new_state ) +static void tdfxDDInvalidateState( struct gl_context *ctx, GLuint new_state ) { _swrast_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); @@ -1242,7 +1242,7 @@ static void tdfxDDInvalidateState( GLcontext *ctx, GLuint new_state ) */ void tdfxInitState( tdfxContextPtr fxMesa ) { - GLcontext *ctx = fxMesa->glCtx; + struct gl_context *ctx = fxMesa->glCtx; GLint i; fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_LOCAL; @@ -1390,7 +1390,7 @@ void tdfxInitState( tdfxContextPtr fxMesa ) -void tdfxDDInitStateFuncs( GLcontext *ctx ) +void tdfxDDInitStateFuncs( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/tdfx/tdfx_state.h b/src/mesa/drivers/dri/tdfx/tdfx_state.h index 4880b990fc..2e96fcbeb5 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_state.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_state.h @@ -40,21 +40,21 @@ #include "main/context.h" #include "tdfx_context.h" -extern void tdfxDDInitStateFuncs( GLcontext *ctx ); +extern void tdfxDDInitStateFuncs( struct gl_context *ctx ); -extern void tdfxDDUpdateHwState( GLcontext *ctx ); +extern void tdfxDDUpdateHwState( struct gl_context *ctx ); extern void tdfxInitState( tdfxContextPtr fxMesa ); -extern void tdfxUpdateClipping( GLcontext *ctx ); +extern void tdfxUpdateClipping( struct gl_context *ctx ); -extern void tdfxFallback( GLcontext *ctx, GLuint bit, GLboolean mode ); +extern void tdfxFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ); #define FALLBACK( rmesa, bit, mode ) tdfxFallback( rmesa->glCtx, bit, mode ) -extern void tdfxUpdateCull( GLcontext *ctx ); -extern void tdfxUpdateStipple( GLcontext *ctx ); -extern void tdfxUpdateViewport( GLcontext *ctx ); +extern void tdfxUpdateCull( struct gl_context *ctx ); +extern void tdfxUpdateStipple( struct gl_context *ctx ); +extern void tdfxUpdateViewport( struct gl_context *ctx ); #endif diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c index 1c51452c10..0326b847cb 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c @@ -52,7 +52,7 @@ /* no borders! can't halve 1x1! (stride > width * comp) not allowed */ static void -_mesa_halve2x2_teximage2d ( GLcontext *ctx, +_mesa_halve2x2_teximage2d ( struct gl_context *ctx, struct gl_texture_image *texImage, GLuint bytesPerPixel, GLint srcWidth, GLint srcHeight, @@ -176,7 +176,7 @@ logbase2(int n) static void -tdfxGenerateMipmap(GLcontext *ctx, GLenum target, +tdfxGenerateMipmap(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj) { GLint mipWidth, mipHeight; @@ -242,7 +242,7 @@ tdfxGenerateMipmap(GLcontext *ctx, GLenum target, * 32 32 GR_LOD_LOG2_32 (=5) GR_ASPECT_LOG2_1x1 (=0) */ static void -tdfxTexGetInfo(const GLcontext *ctx, int w, int h, +tdfxTexGetInfo(const struct gl_context *ctx, int w, int h, GrLOD_t *lodlevel, GrAspectRatio_t *aspectratio, float *sscale, float *tscale, int *wscale, int *hscale) @@ -307,7 +307,7 @@ tdfxTexGetInfo(const GLcontext *ctx, int w, int h, * We need to call this when a texture object's minification filter * or texture image sizes change. */ -static void RevalidateTexture(GLcontext *ctx, struct gl_texture_object *tObj) +static void RevalidateTexture(struct gl_context *ctx, struct gl_texture_object *tObj) { tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj); GLint minl, maxl; @@ -390,7 +390,7 @@ fxAllocTexObjData(tdfxContextPtr fxMesa) * Called via glBindTexture. */ static void -tdfxBindTexture(GLcontext * ctx, GLenum target, +tdfxBindTexture(struct gl_context * ctx, GLenum target, struct gl_texture_object *tObj) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -419,7 +419,7 @@ tdfxBindTexture(GLcontext * ctx, GLenum target, * Called via glTexEnv. */ static void -tdfxTexEnv(GLcontext * ctx, GLenum target, GLenum pname, +tdfxTexEnv(struct gl_context * ctx, GLenum target, GLenum pname, const GLfloat * param) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -445,7 +445,7 @@ tdfxTexEnv(GLcontext * ctx, GLenum target, GLenum pname, * Called via glTexParameter. */ static void -tdfxTexParameter(GLcontext * ctx, GLenum target, +tdfxTexParameter(struct gl_context * ctx, GLenum target, struct gl_texture_object *tObj, GLenum pname, const GLfloat * params) { @@ -610,7 +610,7 @@ tdfxTexParameter(GLcontext * ctx, GLenum target, * Here, we delete the Glide data associated with the texture. */ static void -tdfxDeleteTexture(GLcontext * ctx, struct gl_texture_object *tObj) +tdfxDeleteTexture(struct gl_context * ctx, struct gl_texture_object *tObj) { if (ctx && ctx->DriverCtx) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -626,7 +626,7 @@ tdfxDeleteTexture(GLcontext * ctx, struct gl_texture_object *tObj) * Return true if texture is resident, false otherwise. */ static GLboolean -tdfxIsTextureResident(GLcontext *ctx, struct gl_texture_object *tObj) +tdfxIsTextureResident(struct gl_context *ctx, struct gl_texture_object *tObj) { tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj); return (GLboolean) (ti && ti->isInTM); @@ -707,7 +707,7 @@ convertPalette(FxU32 data[256], const struct gl_color_table *table) static void -tdfxUpdateTexturePalette(GLcontext * ctx, struct gl_texture_object *tObj) +tdfxUpdateTexturePalette(struct gl_context * ctx, struct gl_texture_object *tObj) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -760,7 +760,7 @@ fxTexusError(const char *string, FxBool fatal) static gl_format -tdfxChooseTextureFormat( GLcontext *ctx, GLint internalFormat, +tdfxChooseTextureFormat( struct gl_context *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -1216,7 +1216,7 @@ fxFetchFunction(GLint mesaFormat) static GLboolean -adjust2DRatio (GLcontext *ctx, +adjust2DRatio (struct gl_context *ctx, GLint xoffset, GLint yoffset, GLint width, GLint height, GLenum format, GLenum type, const GLvoid *pixels, @@ -1302,7 +1302,7 @@ adjust2DRatio (GLcontext *ctx, static void -tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level, +tdfxTexImage2D(struct gl_context *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, @@ -1454,7 +1454,7 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level, static void -tdfxTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, +tdfxTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -1521,7 +1521,7 @@ tdfxTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, static void -tdfxTexImage1D(GLcontext *ctx, GLenum target, GLint level, +tdfxTexImage1D(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, @@ -1537,7 +1537,7 @@ tdfxTexImage1D(GLcontext *ctx, GLenum target, GLint level, } static void -tdfxTexSubImage1D(GLcontext *ctx, GLenum target, GLint level, +tdfxTexSubImage1D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, @@ -1561,7 +1561,7 @@ tdfxTexSubImage1D(GLcontext *ctx, GLenum target, GLint level, /**********************************************************************/ static void -tdfxCompressedTexImage2D (GLcontext *ctx, GLenum target, +tdfxCompressedTexImage2D (struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data, @@ -1671,7 +1671,7 @@ tdfxCompressedTexImage2D (GLcontext *ctx, GLenum target, static void -tdfxCompressedTexSubImage2D( GLcontext *ctx, GLenum target, +tdfxCompressedTexSubImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLint height, GLenum format, @@ -1752,7 +1752,7 @@ PrintTexture(int w, int h, int c, const GLubyte * data) GLboolean -tdfxTestProxyTexImage(GLcontext *ctx, GLenum target, +tdfxTestProxyTexImage(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLenum format, GLenum type, GLint width, GLint height, @@ -1840,7 +1840,7 @@ tdfxTestProxyTexImage(GLcontext *ctx, GLenum target, * texture object from the core mesa gl_texture_object. Not done at this time. */ static struct gl_texture_object * -tdfxNewTextureObject( GLcontext *ctx, GLuint name, GLenum target ) +tdfxNewTextureObject( struct gl_context *ctx, GLuint name, GLenum target ) { struct gl_texture_object *obj; obj = _mesa_new_texture_object(ctx, name, target); diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.h b/src/mesa/drivers/dri/tdfx/tdfx_tex.h index a445935a01..26885fae3e 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tex.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.h @@ -47,47 +47,47 @@ extern void -tdfxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj); +tdfxTexValidate(struct gl_context * ctx, struct gl_texture_object *tObj); #if 000 /* DEAD? */ extern void -fxDDTexUseGlobalPalette(GLcontext * ctx, GLboolean state); +fxDDTexUseGlobalPalette(struct gl_context * ctx, GLboolean state); #endif extern GLboolean -tdfxTestProxyTexImage(GLcontext *ctx, GLenum target, +tdfxTestProxyTexImage(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLenum format, GLenum type, GLint width, GLint height, GLint depth, GLint border); extern GLvoid * -tdfxDDGetTexImage(GLcontext * ctx, GLenum target, GLint level, +tdfxDDGetTexImage(struct gl_context * ctx, GLenum target, GLint level, const struct gl_texture_object *texObj, GLenum * formatOut, GLenum * typeOut, GLboolean * freeImageOut); extern void -tdfxDDGetCompressedTexImage( GLcontext *ctx, GLenum target, +tdfxDDGetCompressedTexImage( struct gl_context *ctx, GLenum target, GLint lod, void *image, const struct gl_texture_object *texObj, struct gl_texture_image *texImage ); extern GLint -tdfxSpecificCompressedTexFormat(GLcontext *ctx, +tdfxSpecificCompressedTexFormat(struct gl_context *ctx, GLint internalFormat, GLint numDimensions); extern GLint -tdfxBaseCompressedTexFormat(GLcontext *ctx, +tdfxBaseCompressedTexFormat(struct gl_context *ctx, GLint internalFormat); extern GLboolean -tdfxDDIsCompressedFormat(GLcontext *ctx, GLint internalFormat); +tdfxDDIsCompressedFormat(struct gl_context *ctx, GLint internalFormat); extern GLsizei -tdfxDDCompressedImageSize(GLcontext *ctx, +tdfxDDCompressedImageSize(struct gl_context *ctx, GLenum intFormat, GLuint numDimensions, GLuint width, diff --git a/src/mesa/drivers/dri/tdfx/tdfx_texman.c b/src/mesa/drivers/dri/tdfx/tdfx_texman.c index 726cc58a10..1160ae2d0b 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_texman.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_texman.c @@ -744,7 +744,7 @@ tdfxTMDownloadTexture(tdfxContextPtr fxMesa, struct gl_texture_object *tObj) void -tdfxTMReloadMipMapLevel(GLcontext *ctx, struct gl_texture_object *tObj, +tdfxTMReloadMipMapLevel(struct gl_context *ctx, struct gl_texture_object *tObj, GLint level) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -917,6 +917,7 @@ tdfxTMMoveOutTM_NoLock( tdfxContextPtr fxMesa, struct gl_texture_object *tObj ) case TDFX_TMU_SPLIT: case TDFX_TMU_BOTH: assert(!shared->umaTexMemory); + (void) shared; RemoveRange_NoLock(fxMesa, TDFX_TMU0, ti->tm[TDFX_TMU0]); RemoveRange_NoLock(fxMesa, TDFX_TMU1, ti->tm[TDFX_TMU1]); break; @@ -963,7 +964,7 @@ tdfxTMFreeTexture(tdfxContextPtr fxMesa, struct gl_texture_object *tObj) */ void tdfxTMRestoreTextures_NoLock( tdfxContextPtr fxMesa ) { - GLcontext *ctx = fxMesa->glCtx; + struct gl_context *ctx = fxMesa->glCtx; struct _mesa_HashTable *textures = fxMesa->glCtx->Shared->TexObjects; GLuint id; diff --git a/src/mesa/drivers/dri/tdfx/tdfx_texman.h b/src/mesa/drivers/dri/tdfx/tdfx_texman.h index a9af4cb7c5..87bdc3fea9 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_texman.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_texman.h @@ -48,7 +48,7 @@ extern void tdfxTMClose( tdfxContextPtr fxMesa ); extern void tdfxTMDownloadTexture(tdfxContextPtr fxMesa, struct gl_texture_object *tObj); -extern void tdfxTMReloadMipMapLevel( GLcontext *ctx, +extern void tdfxTMReloadMipMapLevel( struct gl_context *ctx, struct gl_texture_object *tObj, GLint level ); diff --git a/src/mesa/drivers/dri/tdfx/tdfx_texstate.c b/src/mesa/drivers/dri/tdfx/tdfx_texstate.c index b04f48c7a7..227f36be65 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_texstate.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_texstate.c @@ -160,7 +160,7 @@ * If we fail, we'll have to use software rendering. */ static GLboolean -SetupTexEnvNapalm(GLcontext *ctx, GLboolean useIteratedRGBA, +SetupTexEnvNapalm(struct gl_context *ctx, GLboolean useIteratedRGBA, const struct gl_texture_unit *texUnit, GLenum baseFormat, struct tdfx_texcombine_ext *env) { @@ -838,7 +838,7 @@ SetupTexEnvNapalm(GLcontext *ctx, GLboolean useIteratedRGBA, * If failure, we'll use software rendering. */ static GLboolean -SetupSingleTexEnvVoodoo3(GLcontext *ctx, int unit, +SetupSingleTexEnvVoodoo3(struct gl_context *ctx, int unit, GLenum envMode, GLenum baseFormat) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -1047,7 +1047,7 @@ SetupSingleTexEnvVoodoo3(GLcontext *ctx, int unit, * If failure, we'll use software rendering. */ static GLboolean -SetupDoubleTexEnvVoodoo3(GLcontext *ctx, int tmu0, +SetupDoubleTexEnvVoodoo3(struct gl_context *ctx, int tmu0, GLenum envMode0, GLenum baseFormat0, GLenum envMode1, GLenum baseFormat1) { @@ -1362,7 +1362,7 @@ setupSingleTMU(tdfxContextPtr fxMesa, struct gl_texture_object *tObj) { struct tdfxSharedState *shared = (struct tdfxSharedState *) fxMesa->glCtx->Shared->DriverData; tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj); - const GLcontext *ctx = fxMesa->glCtx; + const struct gl_context *ctx = fxMesa->glCtx; /* Make sure we're not loaded incorrectly */ if (ti->isInTM && !shared->umaTexMemory) { @@ -1571,7 +1571,7 @@ selectSingleTMUSrc(tdfxContextPtr fxMesa, GLint tmu, FxBool LODblend) #if 0 static void print_state(tdfxContextPtr fxMesa) { - GLcontext *ctx = fxMesa->glCtx; + struct gl_context *ctx = fxMesa->glCtx; struct gl_texture_object *tObj0 = ctx->Texture.Unit[0]._Current; struct gl_texture_object *tObj1 = ctx->Texture.Unit[1]._Current; GLenum base0 = tObj0->Image[0][tObj0->BaseLevel] ? tObj0->Image[0][tObj0->BaseLevel]->Format : 99; @@ -1599,7 +1599,7 @@ static void print_state(tdfxContextPtr fxMesa) * Input: ctx - the context * unit - the OpenGL texture unit to use. */ -static void setupTextureSingleTMU(GLcontext * ctx, GLuint unit) +static void setupTextureSingleTMU(struct gl_context * ctx, GLuint unit) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); tdfxTexInfo *ti; @@ -1715,7 +1715,7 @@ setupDoubleTMU(tdfxContextPtr fxMesa, const struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared; const struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData; - const GLcontext *ctx = fxMesa->glCtx; + const struct gl_context *ctx = fxMesa->glCtx; tdfxTexInfo *ti0 = TDFX_TEXTURE_DATA(tObj0); tdfxTexInfo *ti1 = TDFX_TEXTURE_DATA(tObj1); GLuint tstate = 0; @@ -1914,7 +1914,7 @@ setupDoubleTMU(tdfxContextPtr fxMesa, #undef T1_IN_TMU1 } -static void setupTextureDoubleTMU(GLcontext * ctx) +static void setupTextureDoubleTMU(struct gl_context * ctx) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); struct gl_texture_object *tObj0 = ctx->Texture.Unit[1]._Current; @@ -2019,7 +2019,7 @@ static void setupTextureDoubleTMU(GLcontext * ctx) void -tdfxUpdateTextureState( GLcontext *ctx ) +tdfxUpdateTextureState( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -2108,7 +2108,7 @@ tdfxUpdateTextureState( GLcontext *ctx ) * This is very common in Quake3. */ void -tdfxUpdateTextureBinding( GLcontext *ctx ) +tdfxUpdateTextureBinding( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); struct gl_texture_object *tObj0 = ctx->Texture.Unit[0]._Current; diff --git a/src/mesa/drivers/dri/tdfx/tdfx_texstate.h b/src/mesa/drivers/dri/tdfx/tdfx_texstate.h index 0c5c4101ca..92ac3a37eb 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_texstate.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_texstate.h @@ -37,7 +37,7 @@ #ifndef __TDFX_TEXSTATE_H__ #define __TDFX_TEXSTATE_H__ -extern void tdfxUpdateTextureState( GLcontext *ctx ); -extern void tdfxUpdateTextureBinding( GLcontext *ctx ); +extern void tdfxUpdateTextureState( struct gl_context *ctx ); +extern void tdfxUpdateTextureBinding( struct gl_context *ctx ); #endif diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tris.c b/src/mesa/drivers/dri/tdfx/tdfx_tris.c index d65833c20b..1f8cf6cde1 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tris.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tris.c @@ -49,8 +49,8 @@ #include "tdfx_render.h" -static void tdfxRasterPrimitive( GLcontext *ctx, GLenum prim ); -static void tdfxRenderPrimitive( GLcontext *ctx, GLenum prim ); +static void tdfxRasterPrimitive( struct gl_context *ctx, GLenum prim ); +static void tdfxRenderPrimitive( struct gl_context *ctx, GLenum prim ); static GLenum reduced_prim[GL_POLYGON+1] = { GL_POINTS, @@ -136,7 +136,7 @@ do { \ * primitives. */ static void -tdfx_translate_vertex( GLcontext *ctx, const tdfxVertex *src, SWvertex *dst) +tdfx_translate_vertex( struct gl_context *ctx, const tdfxVertex *src, SWvertex *dst) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -193,7 +193,7 @@ tdfx_fallback_tri( tdfxContextPtr fxMesa, tdfxVertex *v1, tdfxVertex *v2 ) { - GLcontext *ctx = fxMesa->glCtx; + struct gl_context *ctx = fxMesa->glCtx; SWvertex v[3]; tdfx_translate_vertex( ctx, v0, &v[0] ); tdfx_translate_vertex( ctx, v1, &v[1] ); @@ -207,7 +207,7 @@ tdfx_fallback_line( tdfxContextPtr fxMesa, tdfxVertex *v0, tdfxVertex *v1 ) { - GLcontext *ctx = fxMesa->glCtx; + struct gl_context *ctx = fxMesa->glCtx; SWvertex v[2]; tdfx_translate_vertex( ctx, v0, &v[0] ); tdfx_translate_vertex( ctx, v1, &v[1] ); @@ -219,7 +219,7 @@ static void tdfx_fallback_point( tdfxContextPtr fxMesa, tdfxVertex *v0 ) { - GLcontext *ctx = fxMesa->glCtx; + struct gl_context *ctx = fxMesa->glCtx; SWvertex v[1]; tdfx_translate_vertex( ctx, v0, &v[0] ); _swrast_Point( ctx, &v[0] ); @@ -229,7 +229,7 @@ tdfx_fallback_point( tdfxContextPtr fxMesa, * Functions to draw basic primitives * ***********************************************************************/ -static void tdfx_print_vertex( GLcontext *ctx, const tdfxVertex *v ) +static void tdfx_print_vertex( struct gl_context *ctx, const tdfxVertex *v ) { tdfxContextPtr tmesa = TDFX_CONTEXT( ctx ); @@ -557,7 +557,7 @@ static void init_rast_tab( void ) */ #define INIT(x) tdfxRenderPrimitive( ctx, x ) -static void tdfx_render_vb_points( GLcontext *ctx, +static void tdfx_render_vb_points( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -584,7 +584,7 @@ static void tdfx_render_vb_points( GLcontext *ctx, } } -static void tdfx_render_vb_line_strip( GLcontext *ctx, +static void tdfx_render_vb_line_strip( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -612,7 +612,7 @@ static void tdfx_render_vb_line_strip( GLcontext *ctx, } } -static void tdfx_render_vb_line_loop( GLcontext *ctx, +static void tdfx_render_vb_line_loop( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -649,7 +649,7 @@ static void tdfx_render_vb_line_loop( GLcontext *ctx, } } -static void tdfx_render_vb_lines( GLcontext *ctx, +static void tdfx_render_vb_lines( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -677,7 +677,7 @@ static void tdfx_render_vb_lines( GLcontext *ctx, } } -static void tdfx_render_vb_triangles( GLcontext *ctx, +static void tdfx_render_vb_triangles( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -708,7 +708,7 @@ static void tdfx_render_vb_triangles( GLcontext *ctx, } -static void tdfx_render_vb_tri_strip( GLcontext *ctx, +static void tdfx_render_vb_tri_strip( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -730,7 +730,7 @@ static void tdfx_render_vb_tri_strip( GLcontext *ctx, } -static void tdfx_render_vb_tri_fan( GLcontext *ctx, +static void tdfx_render_vb_tri_fan( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -745,7 +745,7 @@ static void tdfx_render_vb_tri_fan( GLcontext *ctx, fxVB + start, sizeof(tdfxVertex) ); } -static void tdfx_render_vb_quads( GLcontext *ctx, +static void tdfx_render_vb_quads( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -771,7 +771,7 @@ static void tdfx_render_vb_quads( GLcontext *ctx, } } -static void tdfx_render_vb_quad_strip( GLcontext *ctx, +static void tdfx_render_vb_quad_strip( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -788,7 +788,7 @@ static void tdfx_render_vb_quad_strip( GLcontext *ctx, count-start, fxVB + start, sizeof(tdfxVertex)); } -static void tdfx_render_vb_poly( GLcontext *ctx, +static void tdfx_render_vb_poly( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -803,7 +803,7 @@ static void tdfx_render_vb_poly( GLcontext *ctx, fxVB + start, sizeof(tdfxVertex)); } -static void tdfx_render_vb_noop( GLcontext *ctx, +static void tdfx_render_vb_noop( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -811,7 +811,7 @@ static void tdfx_render_vb_noop( GLcontext *ctx, (void) (ctx && start && count && flags); } -static void (*tdfx_render_tab_verts[GL_POLYGON+2])(GLcontext *, +static void (*tdfx_render_tab_verts[GL_POLYGON+2])(struct gl_context *, GLuint, GLuint, GLuint) = @@ -897,7 +897,7 @@ static void (*tdfx_render_tab_verts[GL_POLYGON+2])(GLcontext *, -static void tdfxRenderClippedPoly( GLcontext *ctx, const GLuint *elts, +static void tdfxRenderClippedPoly( struct gl_context *ctx, const GLuint *elts, GLuint n ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -920,13 +920,13 @@ static void tdfxRenderClippedPoly( GLcontext *ctx, const GLuint *elts, tnl->Driver.Render.PrimitiveNotify( ctx, prim ); } -static void tdfxRenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) +static void tdfxRenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->Driver.Render.Line( ctx, ii, jj ); } -static void tdfxFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, +static void tdfxFastRenderClippedPoly( struct gl_context *ctx, const GLuint *elts, GLuint n ) { int i; @@ -974,7 +974,7 @@ static void tdfxFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, _NEW_POLYGONSTIPPLE) -static void tdfxChooseRenderState(GLcontext *ctx) +static void tdfxChooseRenderState(struct gl_context *ctx) { TNLcontext *tnl = TNL_CONTEXT(ctx); tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -1061,7 +1061,7 @@ static void tdfxChooseRenderState(GLcontext *ctx) * TODO: Use single back-buffer cliprect where possible. * NOTE: <pass> starts at 1, not zero! */ -static GLboolean multipass_cliprect( GLcontext *ctx, GLuint pass ) +static GLboolean multipass_cliprect( struct gl_context *ctx, GLuint pass ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); if (pass >= fxMesa->numClipRects) @@ -1081,7 +1081,7 @@ static GLboolean multipass_cliprect( GLcontext *ctx, GLuint pass ) /* Runtime render state and callbacks */ /**********************************************************************/ -static void tdfxRunPipeline( GLcontext *ctx ) +static void tdfxRunPipeline( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -1103,7 +1103,7 @@ static void tdfxRunPipeline( GLcontext *ctx ) } -static void tdfxRenderStart( GLcontext *ctx ) +static void tdfxRenderStart( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -1138,7 +1138,7 @@ static void tdfxRenderStart( GLcontext *ctx ) /* Always called between RenderStart and RenderFinish --> We already * hold the lock. */ -static void tdfxRasterPrimitive( GLcontext *ctx, GLenum prim ) +static void tdfxRasterPrimitive( struct gl_context *ctx, GLenum prim ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); @@ -1170,7 +1170,7 @@ static void tdfxRasterPrimitive( GLcontext *ctx, GLenum prim ) * which renders strips as strips, the equivalent calculations are * performed in tdfx_render.c. */ -static void tdfxRenderPrimitive( GLcontext *ctx, GLenum prim ) +static void tdfxRenderPrimitive( struct gl_context *ctx, GLenum prim ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); GLuint rprim = reduced_prim[prim]; @@ -1185,7 +1185,7 @@ static void tdfxRenderPrimitive( GLcontext *ctx, GLenum prim ) } } -static void tdfxRenderFinish( GLcontext *ctx ) +static void tdfxRenderFinish( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -1227,7 +1227,7 @@ static char *getFallbackString(GLuint bit) } -void tdfxFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) +void tdfxFallback( struct gl_context *ctx, GLuint bit, GLboolean mode ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); @@ -1266,7 +1266,7 @@ void tdfxFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) } -void tdfxDDInitTriFuncs( GLcontext *ctx ) +void tdfxDDInitTriFuncs( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tris.h b/src/mesa/drivers/dri/tdfx/tdfx_tris.h index ec48a48692..421b8e1c0d 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tris.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_tris.h @@ -35,7 +35,7 @@ #include "main/mtypes.h" -extern void tdfxDDInitTriFuncs( GLcontext *ctx ); +extern void tdfxDDInitTriFuncs( struct gl_context *ctx ); #endif diff --git a/src/mesa/drivers/dri/tdfx/tdfx_vb.c b/src/mesa/drivers/dri/tdfx/tdfx_vb.c index 546d89aa84..dafb6eccd9 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_vb.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_vb.c @@ -33,7 +33,7 @@ #include "tdfx_vb.h" #include "tdfx_render.h" -static void copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc ) +static void copy_pv( struct gl_context *ctx, GLuint edst, GLuint esrc ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); tdfxVertex *dst = fxMesa->verts + edst; @@ -42,10 +42,10 @@ static void copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc ) } static struct { - void (*emit)( GLcontext *, GLuint, GLuint, void * ); + void (*emit)( struct gl_context *, GLuint, GLuint, void * ); tnl_interp_func interp; tnl_copy_pv_func copy_pv; - GLboolean (*check_tex_sizes)( GLcontext *ctx ); + GLboolean (*check_tex_sizes)( struct gl_context *ctx ); GLuint vertex_format; } setup_tab[TDFX_MAX_SETUP]; @@ -55,7 +55,7 @@ static struct { #define GET_COLOR(ptr, idx) ((ptr)->data[idx]) -static void interp_extras( GLcontext *ctx, +static void interp_extras( struct gl_context *ctx, GLfloat t, GLuint dst, GLuint out, GLuint in, GLboolean force_boundary ) @@ -79,7 +79,7 @@ static void interp_extras( GLcontext *ctx, force_boundary); } -static void copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src ) +static void copy_pv_extras( struct gl_context *ctx, GLuint dst, GLuint src ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; @@ -204,7 +204,7 @@ void tdfxPrintSetupFlags(char *msg, GLuint flags ) -void tdfxCheckTexSizes( GLcontext *ctx ) +void tdfxCheckTexSizes( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); @@ -234,7 +234,7 @@ void tdfxCheckTexSizes( GLcontext *ctx ) } -void tdfxBuildVertices( GLcontext *ctx, GLuint start, GLuint end, +void tdfxBuildVertices( struct gl_context *ctx, GLuint start, GLuint end, GLuint newinputs ) { tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); @@ -275,7 +275,7 @@ void tdfxBuildVertices( GLcontext *ctx, GLuint start, GLuint end, } -void tdfxChooseVertexState( GLcontext *ctx ) +void tdfxChooseVertexState( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); @@ -321,7 +321,7 @@ void tdfxChooseVertexState( GLcontext *ctx ) -void tdfxInitVB( GLcontext *ctx ) +void tdfxInitVB( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); GLuint size = TNL_CONTEXT(ctx)->vb.Size; @@ -337,7 +337,7 @@ void tdfxInitVB( GLcontext *ctx ) } -void tdfxFreeVB( GLcontext *ctx ) +void tdfxFreeVB( struct gl_context *ctx ) { tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); if (fxMesa->verts) { diff --git a/src/mesa/drivers/dri/tdfx/tdfx_vb.h b/src/mesa/drivers/dri/tdfx/tdfx_vb.h index 1e190e85f6..238a076d87 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_vb.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_vb.h @@ -48,21 +48,21 @@ _NEW_FOG) -extern void tdfxValidateBuildProjVerts(GLcontext *ctx, +extern void tdfxValidateBuildProjVerts(struct gl_context *ctx, GLuint start, GLuint count, GLuint newinputs ); extern void tdfxPrintSetupFlags(char *msg, GLuint flags ); -extern void tdfxInitVB( GLcontext *ctx ); +extern void tdfxInitVB( struct gl_context *ctx ); -extern void tdfxFreeVB( GLcontext *ctx ); +extern void tdfxFreeVB( struct gl_context *ctx ); -extern void tdfxCheckTexSizes( GLcontext *ctx ); +extern void tdfxCheckTexSizes( struct gl_context *ctx ); -extern void tdfxChooseVertexState( GLcontext *ctx ); +extern void tdfxChooseVertexState( struct gl_context *ctx ); -extern void tdfxBuildVertices( GLcontext *ctx, GLuint start, GLuint end, +extern void tdfxBuildVertices( struct gl_context *ctx, GLuint start, GLuint end, GLuint newinputs ); #endif diff --git a/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h b/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h index 19baf7d0d2..c593ce05ea 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h @@ -33,7 +33,7 @@ #define VIEWPORT_Z(dst,z) dst = s[10] * z + s[14] -static void TAG(emit)( GLcontext *ctx, +static void TAG(emit)( struct gl_context *ctx, GLuint start, GLuint end, void *dest ) { @@ -157,7 +157,7 @@ static void TAG(emit)( GLcontext *ctx, } -static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) +static GLboolean TAG(check_tex_sizes)( struct gl_context *ctx ) { /* fprintf(stderr, "%s\n", __FUNCTION__); */ @@ -183,7 +183,7 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) } -static void TAG(interp)( GLcontext *ctx, +static void TAG(interp)( struct gl_context *ctx, GLfloat t, GLuint edst, GLuint eout, GLuint ein, GLboolean force_boundary ) diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c index 4298c94855..963609bde4 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.c +++ b/src/mesa/drivers/dri/unichrome/via_context.c @@ -77,7 +77,7 @@ GLuint VIA_DEBUG = 0; * * \sa glGetString */ -static const GLubyte *viaGetString(GLcontext *ctx, GLenum name) +static const GLubyte *viaGetString(struct gl_context *ctx, GLenum name) { static char buffer[128]; unsigned offset; @@ -133,7 +133,7 @@ viaDeleteRenderbuffer(struct gl_renderbuffer *rb) } static GLboolean -viaRenderbufferStorage(GLcontext *ctx, struct gl_renderbuffer *rb, +viaRenderbufferStorage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { rb->Width = width; @@ -352,7 +352,7 @@ calculate_buffer_parameters(struct via_context *vmesa, } -void viaReAllocateBuffers(GLcontext *ctx, GLframebuffer *drawbuffer, +void viaReAllocateBuffers(struct gl_context *ctx, struct gl_framebuffer *drawbuffer, GLuint width, GLuint height) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -457,11 +457,11 @@ FreeBuffer(struct via_context *vmesa) GLboolean viaCreateContext(gl_api api, - const __GLcontextModes *visual, + const struct gl_config *visual, __DRIcontext *driContextPriv, void *sharedContextPrivate) { - GLcontext *ctx, *shareCtx; + struct gl_context *ctx, *shareCtx; struct via_context *vmesa; __DRIscreen *sPriv = driContextPriv->driScreenPriv; viaScreenPrivate *viaScreen = (viaScreenPrivate *)sPriv->private; @@ -830,11 +830,11 @@ viaMakeCurrent(__DRIcontext *driContextPriv, if (driContextPriv) { struct via_context *vmesa = (struct via_context *)driContextPriv->driverPrivate; - GLcontext *ctx = vmesa->glCtx; + struct gl_context *ctx = vmesa->glCtx; struct gl_framebuffer *drawBuffer, *readBuffer; - drawBuffer = (GLframebuffer *)driDrawPriv->driverPrivate; - readBuffer = (GLframebuffer *)driReadPriv->driverPrivate; + drawBuffer = (struct gl_framebuffer *)driDrawPriv->driverPrivate; + readBuffer = (struct gl_framebuffer *)driReadPriv->driverPrivate; if ((vmesa->driDrawable != driDrawPriv) || (vmesa->driReadable != driReadPriv)) { @@ -935,7 +935,7 @@ viaSwapBuffers(__DRIdrawable *drawablePrivate) dPriv->driContextPriv->driverPrivate) { struct via_context *vmesa = (struct via_context *)dPriv->driContextPriv->driverPrivate; - GLcontext *ctx = vmesa->glCtx; + struct gl_context *ctx = vmesa->glCtx; _mesa_notifySwapBuffers(ctx); diff --git a/src/mesa/drivers/dri/unichrome/via_context.h b/src/mesa/drivers/dri/unichrome/via_context.h index 4e1ab3a6ca..660e771407 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.h +++ b/src/mesa/drivers/dri/unichrome/via_context.h @@ -153,8 +153,8 @@ struct via_texture_object { struct via_context { GLint refcount; - GLcontext *glCtx; - GLcontext *shareCtx; + struct gl_context *glCtx; + struct gl_context *shareCtx; /* XXX These don't belong here. They should be per-drawable state. */ struct via_renderbuffer front; @@ -394,7 +394,7 @@ extern void viaEmitHwStateLocked(struct via_context *vmesa); extern void viaEmitScissorValues(struct via_context *vmesa, int box_nr, int emit); extern void viaXMesaSetBackClipRects(struct via_context *vmesa); extern void viaXMesaSetFrontClipRects(struct via_context *vmesa); -extern void viaReAllocateBuffers(GLcontext *ctx, GLframebuffer *drawbuffer, GLuint width, GLuint height); +extern void viaReAllocateBuffers(struct gl_context *ctx, struct gl_framebuffer *drawbuffer, GLuint width, GLuint height); extern void viaXMesaWindowMoved(struct via_context *vmesa); extern GLboolean viaTexCombineState(struct via_context *vmesa, diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c index 25aad1b204..116adda18e 100644 --- a/src/mesa/drivers/dri/unichrome/via_ioctl.c +++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c @@ -201,7 +201,7 @@ static void viaFillBuffer(struct via_context *vmesa, -static void viaClear(GLcontext *ctx, GLbitfield mask) +static void viaClear(struct gl_context *ctx, GLbitfield mask) { struct via_context *vmesa = VIA_CONTEXT(ctx); __DRIdrawable *dPriv = vmesa->driDrawable; @@ -951,25 +951,25 @@ void viaFlushDma(struct via_context *vmesa) } } -static void viaFlush(GLcontext *ctx) +static void viaFlush(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); VIA_FLUSH_DMA(vmesa); } -static void viaFinish(GLcontext *ctx) +static void viaFinish(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); VIA_FLUSH_DMA(vmesa); viaWaitIdle(vmesa, GL_FALSE); } -static void viaClearStencil(GLcontext *ctx, int s) +static void viaClearStencil(struct gl_context *ctx, int s) { return; } -void viaInitIoctlFuncs(GLcontext *ctx) +void viaInitIoctlFuncs(struct gl_context *ctx) { ctx->Driver.Flush = viaFlush; ctx->Driver.Clear = viaClear; diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.h b/src/mesa/drivers/dri/unichrome/via_ioctl.h index c6b32cf085..03df789b52 100644 --- a/src/mesa/drivers/dri/unichrome/via_ioctl.h +++ b/src/mesa/drivers/dri/unichrome/via_ioctl.h @@ -32,7 +32,7 @@ void viaFinishPrimitive(struct via_context *vmesa); void viaFlushDma(struct via_context *vmesa); void viaFlushDmaLocked(struct via_context *vmesa, GLuint flags); -void viaInitIoctlFuncs(GLcontext *ctx); +void viaInitIoctlFuncs(struct gl_context *ctx); void viaCopyBuffer(__DRIdrawable *dpriv); void viaPageFlip(__DRIdrawable *dpriv); void viaCheckDma(struct via_context *vmesa, GLuint bytes); diff --git a/src/mesa/drivers/dri/unichrome/via_render.c b/src/mesa/drivers/dri/unichrome/via_render.c index 4351f11955..10e2b4eadd 100644 --- a/src/mesa/drivers/dri/unichrome/via_render.c +++ b/src/mesa/drivers/dri/unichrome/via_render.c @@ -86,7 +86,7 @@ /**********************************************************************/ /* Fast Render pipeline stage */ /**********************************************************************/ -static GLboolean via_run_fastrender(GLcontext *ctx, +static GLboolean via_run_fastrender(struct gl_context *ctx, struct tnl_pipeline_stage *stage) { struct via_context *vmesa = VIA_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index 4b3e9d5a38..9ea656cf02 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -200,7 +200,7 @@ viaDestroyScreen(__DRIscreen *sPriv) static GLboolean viaCreateBuffer(__DRIscreen *driScrnPriv, __DRIdrawable *driDrawPriv, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, GLboolean isPixmap) { #if 0 @@ -311,7 +311,7 @@ viaCreateBuffer(__DRIscreen *driScrnPriv, static void viaDestroyBuffer(__DRIdrawable *driDrawPriv) { - _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL); + _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL); } static const __DRIconfig ** @@ -369,7 +369,7 @@ viaFillInModes( __DRIscreen *psp, * * \todo maybe fold this into intelInitDriver * - * \return the __GLcontextModes supported by this driver + * \return the struct gl_config supported by this driver */ static const __DRIconfig ** viaInitScreen(__DRIscreen *psp) diff --git a/src/mesa/drivers/dri/unichrome/via_screen.h b/src/mesa/drivers/dri/unichrome/via_screen.h index 51df0ce4eb..292646dabd 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.h +++ b/src/mesa/drivers/dri/unichrome/via_screen.h @@ -77,7 +77,7 @@ typedef struct { extern GLboolean viaCreateContext(gl_api api, - const __GLcontextModes *mesaVis, + const struct gl_config *mesaVis, __DRIcontext *driContextPriv, void *sharedContextPrivate); diff --git a/src/mesa/drivers/dri/unichrome/via_span.c b/src/mesa/drivers/dri/unichrome/via_span.c index fa3cbf7a79..4ca584261b 100644 --- a/src/mesa/drivers/dri/unichrome/via_span.c +++ b/src/mesa/drivers/dri/unichrome/via_span.c @@ -149,21 +149,21 @@ /* Move locking out to get reasonable span performance. */ -void viaSpanRenderStart( GLcontext *ctx ) +void viaSpanRenderStart( struct gl_context *ctx ) { struct via_context *vmesa = VIA_CONTEXT(ctx); viaWaitIdle(vmesa, GL_FALSE); LOCK_HARDWARE(vmesa); } -void viaSpanRenderFinish( GLcontext *ctx ) +void viaSpanRenderFinish( struct gl_context *ctx ) { struct via_context *vmesa = VIA_CONTEXT(ctx); _swrast_flush( ctx ); UNLOCK_HARDWARE( vmesa ); } -void viaInitSpanFuncs(GLcontext *ctx) +void viaInitSpanFuncs(struct gl_context *ctx) { struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx); swdd->SpanRenderStart = viaSpanRenderStart; @@ -176,7 +176,7 @@ void viaInitSpanFuncs(GLcontext *ctx) * Plug in the Get/Put routines for the given driRenderbuffer. */ void -viaSetSpanFunctions(struct via_renderbuffer *vrb, const GLvisual *vis) +viaSetSpanFunctions(struct via_renderbuffer *vrb, const struct gl_config *vis) { if (vrb->Base.Format == MESA_FORMAT_RGB565) { viaInitPointers_565(&vrb->Base); diff --git a/src/mesa/drivers/dri/unichrome/via_span.h b/src/mesa/drivers/dri/unichrome/via_span.h index 3dca0d5661..b7abf68538 100644 --- a/src/mesa/drivers/dri/unichrome/via_span.h +++ b/src/mesa/drivers/dri/unichrome/via_span.h @@ -25,11 +25,11 @@ #ifndef _VIA_SPAN_H #define _VIA_SPAN_H -extern void viaInitSpanFuncs(GLcontext *ctx); -extern void viaSpanRenderStart( GLcontext *ctx ); -extern void viaSpanRenderFinish( GLcontext *ctx ); +extern void viaInitSpanFuncs(struct gl_context *ctx); +extern void viaSpanRenderStart( struct gl_context *ctx ); +extern void viaSpanRenderFinish( struct gl_context *ctx ); extern void -viaSetSpanFunctions(struct via_renderbuffer *vrb, const GLvisual *vis); +viaSetSpanFunctions(struct via_renderbuffer *vrb, const struct gl_config *vis); #endif diff --git a/src/mesa/drivers/dri/unichrome/via_state.c b/src/mesa/drivers/dri/unichrome/via_state.c index f7029b9492..033352188d 100644 --- a/src/mesa/drivers/dri/unichrome/via_state.c +++ b/src/mesa/drivers/dri/unichrome/via_state.c @@ -78,7 +78,7 @@ static GLuint viaComputeLodBias(GLfloat bias) void viaEmitState(struct via_context *vmesa) { - GLcontext *ctx = vmesa->glCtx; + struct gl_context *ctx = vmesa->glCtx; GLuint i = 0; GLuint j = 0; RING_VARS; @@ -523,7 +523,7 @@ static INLINE GLuint viaPackColor(GLuint bpp, } } -static void viaBlendEquationSeparate(GLcontext *ctx, +static void viaBlendEquationSeparate(struct gl_context *ctx, GLenum rgbMode, GLenum aMode) { @@ -545,7 +545,7 @@ static void viaBlendEquationSeparate(GLcontext *ctx, ctx->Color.LogicOp != GL_COPY)); } -static void viaBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor) +static void viaBlendFunc(struct gl_context *ctx, GLenum sfactor, GLenum dfactor) { struct via_context *vmesa = VIA_CONTEXT(ctx); GLboolean fallback = GL_FALSE; @@ -580,7 +580,7 @@ static void viaBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor) /* Shouldn't be called as the extension is disabled. */ -static void viaBlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB, +static void viaBlendFuncSeparate(struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA) { @@ -597,7 +597,7 @@ static void viaBlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB, /* ============================================================= * Hardware clipping */ -static void viaScissor(GLcontext *ctx, GLint x, GLint y, +static void viaScissor(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -619,7 +619,7 @@ static void viaScissor(GLcontext *ctx, GLint x, GLint y, vmesa->scissorRect.y2 = vmesa->driDrawable->h - y; } -static void viaEnable(GLcontext *ctx, GLenum cap, GLboolean state) +static void viaEnable(struct gl_context *ctx, GLenum cap, GLboolean state) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -637,13 +637,13 @@ static void viaEnable(GLcontext *ctx, GLenum cap, GLboolean state) /* Fallback to swrast for select and feedback. */ -static void viaRenderMode(GLcontext *ctx, GLenum mode) +static void viaRenderMode(struct gl_context *ctx, GLenum mode) { FALLBACK(VIA_CONTEXT(ctx), VIA_FALLBACK_RENDERMODE, (mode != GL_RENDER)); } -static void viaDrawBuffer(GLcontext *ctx, GLenum mode) +static void viaDrawBuffer(struct gl_context *ctx, GLenum mode) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -678,7 +678,7 @@ static void viaDrawBuffer(GLcontext *ctx, GLenum mode) viaXMesaWindowMoved(vmesa); } -static void viaClearColor(GLcontext *ctx, const GLfloat color[4]) +static void viaClearColor(struct gl_context *ctx, const GLfloat color[4]) { struct via_context *vmesa = VIA_CONTEXT(ctx); GLubyte pcolor[4]; @@ -696,7 +696,7 @@ static void viaClearColor(GLcontext *ctx, const GLfloat color[4]) #define WRITEMASK_GREEN_SHIFT 29 #define WRITEMASK_BLUE_SHIFT 28 -static void viaColorMask(GLcontext *ctx, +static void viaColorMask(struct gl_context *ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a) { @@ -716,7 +716,7 @@ static void viaColorMask(GLcontext *ctx, /* This hardware just isn't capable of private back buffers without * glitches and/or a hefty locking scheme. */ -void viaCalcViewport(GLcontext *ctx) +void viaCalcViewport(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); __DRIdrawable *dPriv = vmesa->driDrawable; @@ -733,20 +733,20 @@ void viaCalcViewport(GLcontext *ctx) m[MAT_TZ] = v[MAT_TZ] * (1.0 / vmesa->depth_max); } -static void viaViewport(GLcontext *ctx, +static void viaViewport(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height) { viaCalcViewport(ctx); } -static void viaDepthRange(GLcontext *ctx, +static void viaDepthRange(struct gl_context *ctx, GLclampd nearval, GLclampd farval) { viaCalcViewport(ctx); } -void viaInitState(GLcontext *ctx) +void viaInitState(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -865,7 +865,7 @@ get_minmag_filter( GLenum min, GLenum mag ) } -static GLboolean viaChooseTextureState(GLcontext *ctx) +static GLboolean viaChooseTextureState(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); struct gl_texture_unit *texUnit0 = &ctx->Texture.Unit[0]; @@ -950,7 +950,7 @@ static GLboolean viaChooseTextureState(GLcontext *ctx) return GL_TRUE; } -static void viaChooseColorState(GLcontext *ctx) +static void viaChooseColorState(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); GLenum s = ctx->Color.BlendSrcRGB; @@ -1246,7 +1246,7 @@ static void viaChooseColorState(GLcontext *ctx) vmesa->regEnable &= ~HC_HenAW_MASK; } -static void viaChooseFogState(GLcontext *ctx) +static void viaChooseFogState(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -1271,7 +1271,7 @@ static void viaChooseFogState(GLcontext *ctx) } } -static void viaChooseDepthState(GLcontext *ctx) +static void viaChooseDepthState(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); if (ctx->Depth.Test) { @@ -1295,7 +1295,7 @@ static void viaChooseDepthState(GLcontext *ctx) } } -static void viaChooseLineState(GLcontext *ctx) +static void viaChooseLineState(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -1309,7 +1309,7 @@ static void viaChooseLineState(GLcontext *ctx) } } -static void viaChoosePolygonState(GLcontext *ctx) +static void viaChoosePolygonState(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -1335,7 +1335,7 @@ static void viaChoosePolygonState(GLcontext *ctx) } } -static void viaChooseStencilState(GLcontext *ctx) +static void viaChooseStencilState(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -1421,7 +1421,7 @@ static void viaChooseStencilState(GLcontext *ctx) -static void viaChooseTriangle(GLcontext *ctx) +static void viaChooseTriangle(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -1445,7 +1445,7 @@ static void viaChooseTriangle(GLcontext *ctx) } } -void viaValidateState( GLcontext *ctx ) +void viaValidateState( struct gl_context *ctx ) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -1492,7 +1492,7 @@ void viaValidateState( GLcontext *ctx ) vmesa->newState = 0; } -static void viaInvalidateState(GLcontext *ctx, GLuint newState) +static void viaInvalidateState(struct gl_context *ctx, GLuint newState) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -1505,7 +1505,7 @@ static void viaInvalidateState(GLcontext *ctx, GLuint newState) _tnl_InvalidateState(ctx, newState); } -void viaInitStateFuncs(GLcontext *ctx) +void viaInitStateFuncs(struct gl_context *ctx) { /* Callbacks for internal Mesa events. */ diff --git a/src/mesa/drivers/dri/unichrome/via_state.h b/src/mesa/drivers/dri/unichrome/via_state.h index 065ec57d33..8a23705520 100644 --- a/src/mesa/drivers/dri/unichrome/via_state.h +++ b/src/mesa/drivers/dri/unichrome/via_state.h @@ -27,10 +27,10 @@ #include "via_context.h" -extern void viaInitState(GLcontext *ctx); -extern void viaInitStateFuncs(GLcontext *ctx); -extern void viaCalcViewport(GLcontext *ctx); -extern void viaValidateState(GLcontext *ctx); +extern void viaInitState(struct gl_context *ctx); +extern void viaInitStateFuncs(struct gl_context *ctx); +extern void viaCalcViewport(struct gl_context *ctx); +extern void viaValidateState(struct gl_context *ctx); extern void viaEmitState(struct via_context *vmesa); extern void viaFallback(struct via_context *vmesa, GLuint bit, GLboolean mode); diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index a64f093326..18fb8f33b9 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -31,8 +31,6 @@ #include "main/mtypes.h" #include "main/enums.h" #include "main/formats.h" -#include "main/colortab.h" -#include "main/convolve.h" #include "main/context.h" #include "main/mipmap.h" #include "main/mm.h" @@ -47,7 +45,7 @@ #include "via_3d_reg.h" static gl_format -viaChooseTexFormat( GLcontext *ctx, GLint internalFormat, +viaChooseTexFormat( struct gl_context *ctx, GLint internalFormat, GLenum format, GLenum type ) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -439,7 +437,7 @@ GLboolean viaSwapOutWork( struct via_context *vmesa ) /* Basically, just collect the image dimensions and addresses for each * image and update the texture object state accordingly. */ -static GLboolean viaSetTexImages(GLcontext *ctx, +static GLboolean viaSetTexImages(struct gl_context *ctx, struct gl_texture_object *texObj) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -626,7 +624,7 @@ static GLboolean viaSetTexImages(GLcontext *ctx, } -GLboolean viaUpdateTextureState( GLcontext *ctx ) +GLboolean viaUpdateTextureState( struct gl_context *ctx ) { struct gl_texture_unit *texUnit = ctx->Texture.Unit; GLuint i; @@ -653,7 +651,7 @@ GLboolean viaUpdateTextureState( GLcontext *ctx ) -static void viaTexImage(GLcontext *ctx, +static void viaTexImage(struct gl_context *ctx, GLint dims, GLenum target, GLint level, GLint internalFormat, @@ -676,11 +674,6 @@ static void viaTexImage(GLcontext *ctx, via_release_pending_textures(vmesa); } - if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) { - _mesa_adjust_image_for_convolution(ctx, dims, &postConvWidth, - &postConvHeight); - } - /* choose the texture format */ texImage->TexFormat = viaChooseTexFormat(ctx, internalFormat, format, type); @@ -805,7 +798,7 @@ static void viaTexImage(GLcontext *ctx, _mesa_unmap_teximage_pbo(ctx, packing); } -static void viaTexImage2D(GLcontext *ctx, +static void viaTexImage2D(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, @@ -820,7 +813,7 @@ static void viaTexImage2D(GLcontext *ctx, packing, texObj, texImage ); } -static void viaTexSubImage2D(GLcontext *ctx, +static void viaTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -841,7 +834,7 @@ static void viaTexSubImage2D(GLcontext *ctx, texImage); } -static void viaTexImage1D(GLcontext *ctx, +static void viaTexImage1D(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, @@ -856,7 +849,7 @@ static void viaTexImage1D(GLcontext *ctx, packing, texObj, texImage ); } -static void viaTexSubImage1D(GLcontext *ctx, +static void viaTexSubImage1D(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, @@ -879,7 +872,7 @@ static void viaTexSubImage1D(GLcontext *ctx, -static GLboolean viaIsTextureResident(GLcontext *ctx, +static GLboolean viaIsTextureResident(struct gl_context *ctx, struct gl_texture_object *texObj) { struct via_texture_object *viaObj = @@ -891,14 +884,14 @@ static GLboolean viaIsTextureResident(GLcontext *ctx, -static struct gl_texture_image *viaNewTextureImage( GLcontext *ctx ) +static struct gl_texture_image *viaNewTextureImage( struct gl_context *ctx ) { (void) ctx; return (struct gl_texture_image *)CALLOC_STRUCT(via_texture_image); } -static struct gl_texture_object *viaNewTextureObject( GLcontext *ctx, +static struct gl_texture_object *viaNewTextureObject( struct gl_context *ctx, GLuint name, GLenum target ) { @@ -913,7 +906,7 @@ static struct gl_texture_object *viaNewTextureObject( GLcontext *ctx, } -static void viaFreeTextureImageData( GLcontext *ctx, +static void viaFreeTextureImageData( struct gl_context *ctx, struct gl_texture_image *texImage ) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -958,7 +951,6 @@ void viaInitTextureFuncs(struct dd_function_table * functions) functions->TextureMemCpy = memcpy; #endif - functions->UpdateTexturePalette = 0; functions->IsTextureResident = viaIsTextureResident; } diff --git a/src/mesa/drivers/dri/unichrome/via_tex.h b/src/mesa/drivers/dri/unichrome/via_tex.h index 25eeee32f3..9495c956b5 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.h +++ b/src/mesa/drivers/dri/unichrome/via_tex.h @@ -30,7 +30,7 @@ struct via_context; -GLboolean viaUpdateTextureState(GLcontext *ctx); +GLboolean viaUpdateTextureState(struct gl_context *ctx); void viaInitTextureFuncs(struct dd_function_table * functions); GLboolean viaSwapOutWork( struct via_context *vmesa ); diff --git a/src/mesa/drivers/dri/unichrome/via_tris.c b/src/mesa/drivers/dri/unichrome/via_tris.c index be3c9a770f..51f6af9228 100644 --- a/src/mesa/drivers/dri/unichrome/via_tris.c +++ b/src/mesa/drivers/dri/unichrome/via_tris.c @@ -490,7 +490,7 @@ via_fallback_tri(struct via_context *vmesa, viaVertex *v1, viaVertex *v2) { - GLcontext *ctx = vmesa->glCtx; + struct gl_context *ctx = vmesa->glCtx; SWvertex v[3]; _swsetup_Translate(ctx, v0, &v[0]); _swsetup_Translate(ctx, v1, &v[1]); @@ -506,7 +506,7 @@ via_fallback_line(struct via_context *vmesa, viaVertex *v0, viaVertex *v1) { - GLcontext *ctx = vmesa->glCtx; + struct gl_context *ctx = vmesa->glCtx; SWvertex v[2]; _swsetup_Translate(ctx, v0, &v[0]); _swsetup_Translate(ctx, v1, &v[1]); @@ -520,7 +520,7 @@ static void via_fallback_point(struct via_context *vmesa, viaVertex *v0) { - GLcontext *ctx = vmesa->glCtx; + struct gl_context *ctx = vmesa->glCtx; SWvertex v[1]; _swsetup_Translate(ctx, v0, &v[0]); viaSpanRenderStart( ctx ); @@ -528,7 +528,7 @@ via_fallback_point(struct via_context *vmesa, viaSpanRenderFinish( ctx ); } -static void viaResetLineStipple( GLcontext *ctx ) +static void viaResetLineStipple( struct gl_context *ctx ) { struct via_context *vmesa = VIA_CONTEXT(ctx); vmesa->regCmdB |= HC_HLPrst_MASK; @@ -578,7 +578,7 @@ static void viaResetLineStipple( GLcontext *ctx ) -static void viaRenderClippedPoly(GLcontext *ctx, const GLuint *elts, +static void viaRenderClippedPoly(struct gl_context *ctx, const GLuint *elts, GLuint n) { TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -602,13 +602,13 @@ static void viaRenderClippedPoly(GLcontext *ctx, const GLuint *elts, tnl->Driver.Render.PrimitiveNotify( ctx, prim ); } -static void viaRenderClippedLine(GLcontext *ctx, GLuint ii, GLuint jj) +static void viaRenderClippedLine(struct gl_context *ctx, GLuint ii, GLuint jj) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->Driver.Render.Line(ctx, ii, jj); } -static void viaFastRenderClippedPoly(GLcontext *ctx, const GLuint *elts, +static void viaFastRenderClippedPoly(struct gl_context *ctx, const GLuint *elts, GLuint n) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -645,7 +645,7 @@ static void viaFastRenderClippedPoly(GLcontext *ctx, const GLuint *elts, _NEW_POLYGONSTIPPLE) -static void viaChooseRenderState(GLcontext *ctx) +static void viaChooseRenderState(struct gl_context *ctx) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -739,7 +739,7 @@ do { \ -static void viaChooseVertexState( GLcontext *ctx ) +static void viaChooseVertexState( struct gl_context *ctx ) { struct via_context *vmesa = VIA_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -822,7 +822,7 @@ static void viaChooseVertexState( GLcontext *ctx ) * them. Fallback to swrast if we can't. Returns GL_TRUE if projective * texture coordinates must be faked, GL_FALSE otherwise. */ -static GLboolean viaCheckPTexHack( GLcontext *ctx ) +static GLboolean viaCheckPTexHack( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; @@ -853,7 +853,7 @@ static GLboolean viaCheckPTexHack( GLcontext *ctx ) /**********************************************************************/ -static void viaRenderStart(GLcontext *ctx) +static void viaRenderStart(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -888,7 +888,7 @@ static void viaRenderStart(GLcontext *ctx) VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr; } -static void viaRenderFinish(GLcontext *ctx) +static void viaRenderFinish(struct gl_context *ctx) { VIA_FINISH_PRIM(VIA_CONTEXT(ctx)); } @@ -897,7 +897,7 @@ static void viaRenderFinish(GLcontext *ctx) /* System to flush dma and emit state changes based on the rasterized * primitive. */ -void viaRasterPrimitive(GLcontext *ctx, +void viaRasterPrimitive(struct gl_context *ctx, GLenum glprim, GLenum hwprim) { @@ -1035,7 +1035,7 @@ void viaRasterPrimitive(GLcontext *ctx, /* Callback for mesa: */ -static void viaRenderPrimitive( GLcontext *ctx, GLuint prim ) +static void viaRenderPrimitive( struct gl_context *ctx, GLuint prim ) { viaRasterPrimitive( ctx, prim, hwPrim[prim] ); } @@ -1103,7 +1103,7 @@ void viaFinishPrimitive(struct via_context *vmesa) void viaFallback(struct via_context *vmesa, GLuint bit, GLboolean mode) { - GLcontext *ctx = vmesa->glCtx; + struct gl_context *ctx = vmesa->glCtx; TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint oldfallback = vmesa->Fallback; @@ -1148,7 +1148,7 @@ void viaFallback(struct via_context *vmesa, GLuint bit, GLboolean mode) } } -static void viaRunPipeline( GLcontext *ctx ) +static void viaRunPipeline( struct gl_context *ctx ) { struct via_context *vmesa = VIA_CONTEXT(ctx); @@ -1166,7 +1166,7 @@ static void viaRunPipeline( GLcontext *ctx ) /**********************************************************************/ -void viaInitTriFuncs(GLcontext *ctx) +void viaInitTriFuncs(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/unichrome/via_tris.h b/src/mesa/drivers/dri/unichrome/via_tris.h index bc6ef4e4eb..4bc83fc624 100644 --- a/src/mesa/drivers/dri/unichrome/via_tris.h +++ b/src/mesa/drivers/dri/unichrome/via_tris.h @@ -28,8 +28,8 @@ #include "main/mtypes.h" extern void viaPrintRenderState(const char *msg, GLuint state); -extern void viaInitTriFuncs(GLcontext *ctx); -extern void viaRasterPrimitive(GLcontext *ctx, GLenum rPrim, GLuint hwPrim); -extern void viaRasterPrimitiveFinish(GLcontext *ctx); +extern void viaInitTriFuncs(struct gl_context *ctx); +extern void viaRasterPrimitive(struct gl_context *ctx, GLenum rPrim, GLuint hwPrim); +extern void viaRasterPrimitiveFinish(struct gl_context *ctx); #endif diff --git a/src/mesa/drivers/fbdev/glfbdev.c b/src/mesa/drivers/fbdev/glfbdev.c index 2ad52d89fc..5195bca97f 100644 --- a/src/mesa/drivers/fbdev/glfbdev.c +++ b/src/mesa/drivers/fbdev/glfbdev.c @@ -73,20 +73,20 @@ /** - * Derived from Mesa's GLvisual class. + * Derived from Mesa's struct gl_config class. */ struct GLFBDevVisualRec { - GLvisual glvisual; /* base class */ + struct gl_config glvisual; /* base class */ struct fb_fix_screeninfo fix; struct fb_var_screeninfo var; int pixelFormat; }; /** - * Derived from Mesa's GLframebuffer class. + * Derived from Mesa's struct gl_framebuffer class. */ struct GLFBDevBufferRec { - GLframebuffer glframebuffer; /* base class */ + struct gl_framebuffer glframebuffer; /* base class */ GLFBDevVisualPtr visual; struct fb_fix_screeninfo fix; struct fb_var_screeninfo var; @@ -95,10 +95,10 @@ struct GLFBDevBufferRec { }; /** - * Derived from Mesa's GLcontext class. + * Derived from Mesa's struct gl_context class. */ struct GLFBDevContextRec { - GLcontext glcontext; /* base class */ + struct gl_context glcontext; /* base class */ GLFBDevVisualPtr visual; GLFBDevBufferPtr drawBuffer; GLFBDevBufferPtr readBuffer; @@ -122,7 +122,7 @@ struct GLFBDevRenderbufferRec { static const GLubyte * -get_string(GLcontext *ctx, GLenum pname) +get_string(struct gl_context *ctx, GLenum pname) { (void) ctx; switch (pname) { @@ -135,7 +135,7 @@ get_string(GLcontext *ctx, GLenum pname) static void -update_state( GLcontext *ctx, GLuint new_state ) +update_state( struct gl_context *ctx, GLuint new_state ) { /* not much to do here - pass it on */ _swrast_InvalidateState( ctx, new_state ); @@ -146,7 +146,7 @@ update_state( GLcontext *ctx, GLuint new_state ) static void -get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height ) +get_buffer_size( struct gl_framebuffer *buffer, GLuint *width, GLuint *height ) { const GLFBDevBufferPtr fbdevbuffer = (GLFBDevBufferPtr) buffer; *width = fbdevbuffer->var.xres; @@ -159,10 +159,10 @@ get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height ) * framebuffer size has changed (and update corresponding state). */ static void -viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) +viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { GLuint newWidth, newHeight; - GLframebuffer *buffer; + struct gl_framebuffer *buffer; buffer = ctx->WinSysDrawBuffer; get_buffer_size( buffer, &newWidth, &newHeight ); @@ -463,7 +463,7 @@ delete_renderbuffer(struct gl_renderbuffer *rb) static GLboolean -renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, +renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { /* no-op: the renderbuffer storage is allocated just once when it's @@ -706,7 +706,7 @@ GLFBDevContextPtr glFBDevCreateContext( const GLFBDevVisualPtr visual, GLFBDevContextPtr share ) { GLFBDevContextPtr ctx; - GLcontext *glctx; + struct gl_context *glctx; struct dd_function_table functions; ASSERT(visual); @@ -732,7 +732,7 @@ glFBDevCreateContext( const GLFBDevVisualPtr visual, GLFBDevContextPtr share ) ctx->visual = visual; /* Create module contexts */ - glctx = (GLcontext *) &ctx->glcontext; + glctx = (struct gl_context *) &ctx->glcontext; _swrast_CreateContext( glctx ); _vbo_CreateContext( glctx ); _tnl_CreateContext( glctx ); @@ -762,7 +762,7 @@ glFBDevDestroyContext( GLFBDevContextPtr context ) GLFBDevContextPtr fbdevctx = glFBDevGetCurrentContext(); if (context) { - GLcontext *mesaCtx = &context->glcontext; + struct gl_context *mesaCtx = &context->glcontext; _swsetup_DestroyContext( mesaCtx ); _swrast_DestroyContext( mesaCtx ); diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c index 93d0e8568a..37dc35cbed 100644 --- a/src/mesa/drivers/osmesa/osmesa.c +++ b/src/mesa/drivers/osmesa/osmesa.c @@ -57,14 +57,14 @@ /** - * OSMesa rendering context, derived from core Mesa GLcontext. + * OSMesa rendering context, derived from core Mesa struct gl_context. */ struct osmesa_context { - GLcontext mesa; /*< Base class - this must be first */ - GLvisual *gl_visual; /*< Describes the buffers */ + struct gl_context mesa; /*< Base class - this must be first */ + struct gl_config *gl_visual; /*< Describes the buffers */ struct gl_renderbuffer *rb; /*< The user's colorbuffer */ - GLframebuffer *gl_buffer; /*< The framebuffer, containing user's rb */ + struct gl_framebuffer *gl_buffer; /*< The framebuffer, containing user's rb */ GLenum format; /*< User-specified context format */ GLint userRowLength; /*< user-specified number of pixels per row */ GLint rInd, gInd, bInd, aInd;/*< index offsets for RGBA formats */ @@ -75,7 +75,7 @@ struct osmesa_context static INLINE OSMesaContext -OSMESA_CONTEXT(GLcontext *ctx) +OSMESA_CONTEXT(struct gl_context *ctx) { /* Just cast, since we're using structure containment */ return (OSMesaContext) ctx; @@ -88,7 +88,7 @@ OSMESA_CONTEXT(GLcontext *ctx) static const GLubyte * -get_string( GLcontext *ctx, GLenum name ) +get_string( struct gl_context *ctx, GLenum name ) { (void) ctx; switch (name) { @@ -107,7 +107,7 @@ get_string( GLcontext *ctx, GLenum name ) static void -osmesa_update_state( GLcontext *ctx, GLuint new_state ) +osmesa_update_state( struct gl_context *ctx, GLuint new_state ) { /* easy - just propogate */ _swrast_InvalidateState( ctx, new_state ); @@ -557,7 +557,7 @@ do { \ * function. Otherwise, return NULL. */ static swrast_line_func -osmesa_choose_line_function( GLcontext *ctx ) +osmesa_choose_line_function( struct gl_context *ctx ) { const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); const SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -668,7 +668,7 @@ osmesa_choose_line_function( GLcontext *ctx ) * Return pointer to an optimized triangle function if possible. */ static swrast_tri_func -osmesa_choose_triangle_function( GLcontext *ctx ) +osmesa_choose_triangle_function( struct gl_context *ctx ) { const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); const SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -708,7 +708,7 @@ osmesa_choose_triangle_function( GLcontext *ctx ) * standard swrast functions. */ static void -osmesa_choose_triangle( GLcontext *ctx ) +osmesa_choose_triangle( struct gl_context *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -718,7 +718,7 @@ osmesa_choose_triangle( GLcontext *ctx ) } static void -osmesa_choose_line( GLcontext *ctx ) +osmesa_choose_line( struct gl_context *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -806,7 +806,7 @@ osmesa_delete_renderbuffer(struct gl_renderbuffer *rb) * Just set up all the gl_renderbuffer methods. */ static GLboolean -osmesa_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, +osmesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); @@ -994,7 +994,7 @@ osmesa_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, * Allocate a new renderbuffer to describe the user-provided color buffer. */ static struct gl_renderbuffer * -new_osmesa_renderbuffer(GLcontext *ctx, GLenum format, GLenum type) +new_osmesa_renderbuffer(struct gl_context *ctx, GLenum format, GLenum type) { const GLuint name = 0; struct gl_renderbuffer *rb = _mesa_new_renderbuffer(ctx, name); @@ -1157,7 +1157,7 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits, if (!_mesa_initialize_context(&osmesa->mesa, osmesa->gl_visual, sharelist ? &sharelist->mesa - : (GLcontext *) NULL, + : (struct gl_context *) NULL, &functions, (void *) osmesa)) { _mesa_destroy_visual( osmesa->gl_visual ); free(osmesa); @@ -1202,7 +1202,7 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits, /* Initialize the software rasterizer and helper modules. */ { - GLcontext *ctx = &osmesa->mesa; + struct gl_context *ctx = &osmesa->mesa; SWcontext *swrast; TNLcontext *tnl; @@ -1367,7 +1367,7 @@ OSMesaMakeCurrent( OSMesaContext osmesa, void *buffer, GLenum type, GLAPI OSMesaContext GLAPIENTRY OSMesaGetCurrentContext( void ) { - GLcontext *ctx = _mesa_get_current_context(); + struct gl_context *ctx = _mesa_get_current_context(); if (ctx) return (OSMesaContext) ctx; else diff --git a/src/mesa/drivers/windows/fx/fxopengl.def b/src/mesa/drivers/windows/fx/fxopengl.def index d65b763d25..bc615e93ae 100644 --- a/src/mesa/drivers/windows/fx/fxopengl.def +++ b/src/mesa/drivers/windows/fx/fxopengl.def @@ -135,8 +135,6 @@ EXPORTS glCopyTexSubImage3D glCopyTexSubImage3DEXT glCullFace - glCullParameterdvEXT - glCullParameterfvEXT glDeleteBuffersARB glDeleteFencesNV glDeleteLists diff --git a/src/mesa/drivers/windows/gdi/wmesa.c b/src/mesa/drivers/windows/gdi/wmesa.c index 22b0c46b4f..833e2526f3 100644 --- a/src/mesa/drivers/windows/gdi/wmesa.c +++ b/src/mesa/drivers/windows/gdi/wmesa.c @@ -30,7 +30,7 @@ static WMesaFramebuffer FirstFramebuffer = NULL; * given HDC (Window handle). */ WMesaFramebuffer -wmesa_new_framebuffer(HDC hdc, GLvisual *visual) +wmesa_new_framebuffer(HDC hdc, struct gl_config *visual) { WMesaFramebuffer pwfb = (WMesaFramebuffer) malloc(sizeof(struct wmesa_framebuffer)); @@ -83,18 +83,18 @@ wmesa_lookup_framebuffer(HDC hdc) /** - * Given a GLframebuffer, return the corresponding WMesaFramebuffer. + * Given a struct gl_framebuffer, return the corresponding WMesaFramebuffer. */ -static WMesaFramebuffer wmesa_framebuffer(GLframebuffer *fb) +static WMesaFramebuffer wmesa_framebuffer(struct gl_framebuffer *fb) { return (WMesaFramebuffer) fb; } /** - * Given a GLcontext, return the corresponding WMesaContext. + * Given a struct gl_context, return the corresponding WMesaContext. */ -static WMesaContext wmesa_context(const GLcontext *ctx) +static WMesaContext wmesa_context(const struct gl_context *ctx) { return (WMesaContext) ctx; } @@ -104,7 +104,7 @@ static WMesaContext wmesa_context(const GLcontext *ctx) * Every driver should implement a GetString function in order to * return a meaningful GL_RENDERER string. */ -static const GLubyte *wmesa_get_string(GLcontext *ctx, GLenum name) +static const GLubyte *wmesa_get_string(struct gl_context *ctx, GLenum name) { return (name == GL_RENDERER) ? (GLubyte *) "Mesa Windows GDI Driver" : NULL; @@ -217,14 +217,14 @@ get_window_size(HDC hdc, GLuint *width, GLuint *height) static void -wmesa_get_buffer_size(GLframebuffer *buffer, GLuint *width, GLuint *height) +wmesa_get_buffer_size(struct gl_framebuffer *buffer, GLuint *width, GLuint *height) { WMesaFramebuffer pwfb = wmesa_framebuffer(buffer); get_window_size(pwfb->hDC, width, height); } -static void wmesa_flush(GLcontext *ctx) +static void wmesa_flush(struct gl_context *ctx) { WMesaContext pwc = wmesa_context(ctx); WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->WinSysDrawBuffer); @@ -250,7 +250,7 @@ static void wmesa_flush(GLcontext *ctx) /* * Set the color used to clear the color buffer. */ -static void clear_color(GLcontext *ctx, const GLfloat color[4]) +static void clear_color(struct gl_context *ctx, const GLfloat color[4]) { WMesaContext pwc = wmesa_context(ctx); WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer); @@ -277,7 +277,7 @@ static void clear_color(GLcontext *ctx, const GLfloat color[4]) * Clearing of the other non-color buffers is left to the swrast. */ -static void clear(GLcontext *ctx, GLbitfield mask) +static void clear(struct gl_context *ctx, GLbitfield mask) { #define FLIP(Y) (ctx->DrawBuffer->Height - (Y) - 1) const GLint x = ctx->DrawBuffer->_Xmin; @@ -447,7 +447,7 @@ static void clear(GLcontext *ctx, GLbitfield mask) **/ /* Write a horizontal span of RGBA color pixels with a boolean mask. */ -static void write_rgba_span_front(const GLcontext *ctx, +static void write_rgba_span_front(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], @@ -534,7 +534,7 @@ static void write_rgba_span_front(const GLcontext *ctx, } /* Write a horizontal span of RGB color pixels with a boolean mask. */ -static void write_rgb_span_front(const GLcontext *ctx, +static void write_rgb_span_front(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const GLubyte rgb[][3], @@ -563,7 +563,7 @@ static void write_rgb_span_front(const GLcontext *ctx, * Write a horizontal span of pixels with a boolean mask. The current color * is used for all pixels. */ -static void write_mono_rgba_span_front(const GLcontext *ctx, +static void write_mono_rgba_span_front(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const GLchan color[4], @@ -588,7 +588,7 @@ static void write_mono_rgba_span_front(const GLcontext *ctx, } /* Write an array of RGBA pixels with a boolean mask. */ -static void write_rgba_pixels_front(const GLcontext *ctx, +static void write_rgba_pixels_front(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], @@ -611,7 +611,7 @@ static void write_rgba_pixels_front(const GLcontext *ctx, * Write an array of pixels with a boolean mask. The current color * is used for all pixels. */ -static void write_mono_rgba_pixels_front(const GLcontext *ctx, +static void write_mono_rgba_pixels_front(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], @@ -629,7 +629,7 @@ static void write_mono_rgba_pixels_front(const GLcontext *ctx, } /* Read a horizontal span of color pixels. */ -static void read_rgba_span_front(const GLcontext *ctx, +static void read_rgba_span_front(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, GLubyte rgba[][4] ) @@ -649,7 +649,7 @@ static void read_rgba_span_front(const GLcontext *ctx, /* Read an array of color pixels. */ -static void read_rgba_pixels_front(const GLcontext *ctx, +static void read_rgba_pixels_front(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4]) @@ -678,7 +678,7 @@ LPDWORD lpdw = ((LPDWORD)((pwc)->pbPixels + (pwc)->ScanWidth * (y)) + (x)); \ /* Write a horizontal span of RGBA color pixels with a boolean mask. */ -static void write_rgba_span_32(const GLcontext *ctx, +static void write_rgba_span_32(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], @@ -708,7 +708,7 @@ static void write_rgba_span_32(const GLcontext *ctx, /* Write a horizontal span of RGB color pixels with a boolean mask. */ -static void write_rgb_span_32(const GLcontext *ctx, +static void write_rgb_span_32(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const GLubyte rgb[][3], @@ -740,7 +740,7 @@ static void write_rgb_span_32(const GLcontext *ctx, * Write a horizontal span of pixels with a boolean mask. The current color * is used for all pixels. */ -static void write_mono_rgba_span_32(const GLcontext *ctx, +static void write_mono_rgba_span_32(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const GLchan color[4], @@ -766,7 +766,7 @@ static void write_mono_rgba_span_32(const GLcontext *ctx, } /* Write an array of RGBA pixels with a boolean mask. */ -static void write_rgba_pixels_32(const GLcontext *ctx, +static void write_rgba_pixels_32(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], @@ -785,7 +785,7 @@ static void write_rgba_pixels_32(const GLcontext *ctx, * Write an array of pixels with a boolean mask. The current color * is used for all pixels. */ -static void write_mono_rgba_pixels_32(const GLcontext *ctx, +static void write_mono_rgba_pixels_32(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], @@ -802,7 +802,7 @@ static void write_mono_rgba_pixels_32(const GLcontext *ctx, } /* Read a horizontal span of color pixels. */ -static void read_rgba_span_32(const GLcontext *ctx, +static void read_rgba_span_32(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, GLubyte rgba[][4] ) @@ -826,7 +826,7 @@ static void read_rgba_span_32(const GLcontext *ctx, /* Read an array of color pixels. */ -static void read_rgba_pixels_32(const GLcontext *ctx, +static void read_rgba_pixels_32(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4]) @@ -860,7 +860,7 @@ lpb[1] = (g); \ lpb[2] = (r); } /* Write a horizontal span of RGBA color pixels with a boolean mask. */ -static void write_rgba_span_24(const GLcontext *ctx, +static void write_rgba_span_24(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], @@ -894,7 +894,7 @@ static void write_rgba_span_24(const GLcontext *ctx, /* Write a horizontal span of RGB color pixels with a boolean mask. */ -static void write_rgb_span_24(const GLcontext *ctx, +static void write_rgb_span_24(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const GLubyte rgb[][3], @@ -930,7 +930,7 @@ static void write_rgb_span_24(const GLcontext *ctx, * Write a horizontal span of pixels with a boolean mask. The current color * is used for all pixels. */ -static void write_mono_rgba_span_24(const GLcontext *ctx, +static void write_mono_rgba_span_24(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const GLchan color[4], @@ -959,7 +959,7 @@ static void write_mono_rgba_span_24(const GLcontext *ctx, } /* Write an array of RGBA pixels with a boolean mask. */ -static void write_rgba_pixels_24(const GLcontext *ctx, +static void write_rgba_pixels_24(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], @@ -978,7 +978,7 @@ static void write_rgba_pixels_24(const GLcontext *ctx, * Write an array of pixels with a boolean mask. The current color * is used for all pixels. */ -static void write_mono_rgba_pixels_24(const GLcontext *ctx, +static void write_mono_rgba_pixels_24(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], @@ -995,7 +995,7 @@ static void write_mono_rgba_pixels_24(const GLcontext *ctx, } /* Read a horizontal span of color pixels. */ -static void read_rgba_span_24(const GLcontext *ctx, +static void read_rgba_span_24(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, GLubyte rgba[][4] ) @@ -1017,7 +1017,7 @@ static void read_rgba_span_24(const GLcontext *ctx, /* Read an array of color pixels. */ -static void read_rgba_pixels_24(const GLcontext *ctx, +static void read_rgba_pixels_24(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4]) @@ -1049,7 +1049,7 @@ LPWORD lpw = ((LPWORD)((pwc)->pbPixels + (pwc)->ScanWidth * (y)) + (x)); \ /* Write a horizontal span of RGBA color pixels with a boolean mask. */ -static void write_rgba_span_16(const GLcontext *ctx, +static void write_rgba_span_16(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], @@ -1079,7 +1079,7 @@ static void write_rgba_span_16(const GLcontext *ctx, /* Write a horizontal span of RGB color pixels with a boolean mask. */ -static void write_rgb_span_16(const GLcontext *ctx, +static void write_rgb_span_16(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const GLubyte rgb[][3], @@ -1111,7 +1111,7 @@ static void write_rgb_span_16(const GLcontext *ctx, * Write a horizontal span of pixels with a boolean mask. The current color * is used for all pixels. */ -static void write_mono_rgba_span_16(const GLcontext *ctx, +static void write_mono_rgba_span_16(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, const GLchan color[4], @@ -1138,7 +1138,7 @@ static void write_mono_rgba_span_16(const GLcontext *ctx, } /* Write an array of RGBA pixels with a boolean mask. */ -static void write_rgba_pixels_16(const GLcontext *ctx, +static void write_rgba_pixels_16(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], @@ -1158,7 +1158,7 @@ static void write_rgba_pixels_16(const GLcontext *ctx, * Write an array of pixels with a boolean mask. The current color * is used for all pixels. */ -static void write_mono_rgba_pixels_16(const GLcontext *ctx, +static void write_mono_rgba_pixels_16(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], @@ -1176,7 +1176,7 @@ static void write_mono_rgba_pixels_16(const GLcontext *ctx, } /* Read a horizontal span of color pixels. */ -static void read_rgba_span_16(const GLcontext *ctx, +static void read_rgba_span_16(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, GLubyte rgba[][4] ) @@ -1200,7 +1200,7 @@ static void read_rgba_span_16(const GLcontext *ctx, /* Read an array of color pixels. */ -static void read_rgba_pixels_16(const GLcontext *ctx, +static void read_rgba_pixels_16(const struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4]) @@ -1244,7 +1244,7 @@ wmesa_delete_renderbuffer(struct gl_renderbuffer *rb) * has changed. Do whatever's needed to cope with that. */ static GLboolean -wmesa_renderbuffer_storage(GLcontext *ctx, +wmesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, @@ -1320,7 +1320,7 @@ void wmesa_set_renderbuffer_funcs(struct gl_renderbuffer *rb, int pixelformat, * Resize the front/back colorbuffers to match the latest window size. */ static void -wmesa_resize_buffers(GLcontext *ctx, GLframebuffer *buffer, +wmesa_resize_buffers(struct gl_context *ctx, struct gl_framebuffer *buffer, GLuint width, GLuint height) { WMesaContext pwc = wmesa_context(ctx); @@ -1348,7 +1348,7 @@ wmesa_resize_buffers(GLcontext *ctx, GLframebuffer *buffer, * we get the viewport set correctly, even if the app does not call * glViewport and relies on the defaults. */ -static void wmesa_viewport(GLcontext *ctx, +static void wmesa_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height) { @@ -1371,7 +1371,7 @@ static void wmesa_viewport(GLcontext *ctx, * Called when the driver should update it's state, based on the new_state * flags. */ -static void wmesa_update_state(GLcontext *ctx, GLuint new_state) +static void wmesa_update_state(struct gl_context *ctx, GLuint new_state) { _swrast_InvalidateState(ctx, new_state); _swsetup_InvalidateState(ctx, new_state); @@ -1403,8 +1403,8 @@ WMesaContext WMesaCreateContext(HDC hDC, WMesaContext c; struct dd_function_table functions; GLint red_bits, green_bits, blue_bits, alpha_bits; - GLcontext *ctx; - GLvisual *visual; + struct gl_context *ctx; + struct gl_config *visual; (void) Pal; @@ -1511,7 +1511,7 @@ WMesaContext WMesaCreateContext(HDC hDC, void WMesaDestroyContext( WMesaContext pwc ) { - GLcontext *ctx = &pwc->gl_ctx; + struct gl_context *ctx = &pwc->gl_ctx; WMesaFramebuffer pwfb; GET_CURRENT_CONTEXT(cur_ctx); @@ -1586,7 +1586,7 @@ void WMesaMakeCurrent(WMesaContext c, HDC hdc) /* Lazy creation of framebuffers */ if (c && !pwfb && hdc) { struct gl_renderbuffer *rb; - GLvisual *visual = &c->gl_ctx.Visual; + struct gl_config *visual = &c->gl_ctx.Visual; GLuint width, height; get_window_size(hdc, &width, &height); diff --git a/src/mesa/drivers/windows/gdi/wmesadef.h b/src/mesa/drivers/windows/gdi/wmesadef.h index 1c0e245111..a73609b007 100644 --- a/src/mesa/drivers/windows/gdi/wmesadef.h +++ b/src/mesa/drivers/windows/gdi/wmesadef.h @@ -7,10 +7,10 @@ /** - * The Windows Mesa rendering context, derived from GLcontext. + * The Windows Mesa rendering context, derived from struct gl_context. */ struct wmesa_context { - GLcontext gl_ctx; /* The core GL/Mesa context */ + struct gl_context gl_ctx; /* The core GL/Mesa context */ HDC hDC; COLORREF clearColorRef; HPEN clearPen; diff --git a/src/mesa/drivers/windows/gldirect/dglcontext.c b/src/mesa/drivers/windows/gldirect/dglcontext.c index a420b36ffb..10ea057850 100644 --- a/src/mesa/drivers/windows/gldirect/dglcontext.c +++ b/src/mesa/drivers/windows/gldirect/dglcontext.c @@ -42,8 +42,8 @@ #ifdef _USE_GLD3_WGL #include "gld_driver.h" -extern void _gld_mesa_warning(GLcontext *, char *); -extern void _gld_mesa_fatal(GLcontext *, char *); +extern void _gld_mesa_warning(struct gl_context *, char *); +extern void _gld_mesa_fatal(struct gl_context *, char *); #endif // _USE_GLD3_WGL // TODO: Clean out old DX6-specific code from GLD 2.x CAD driver diff --git a/src/mesa/drivers/windows/gldirect/dglcontext.h b/src/mesa/drivers/windows/gldirect/dglcontext.h index 5c433b857e..ce04603c19 100644 --- a/src/mesa/drivers/windows/gldirect/dglcontext.h +++ b/src/mesa/drivers/windows/gldirect/dglcontext.h @@ -87,9 +87,9 @@ typedef struct { void *glPriv; // Mesa vars: - GLcontext *glCtx; // The core Mesa context - GLvisual *glVis; // Describes the color buffer - GLframebuffer *glBuffer; // Ancillary buffers + struct gl_context *glCtx; // The core Mesa context + struct gl_config *glVis; // Describes the color buffer + struct gl_framebuffer *glBuffer; // Ancillary buffers GLuint ClearIndex; GLuint CurrentIndex; @@ -135,9 +135,9 @@ typedef struct { // // Mesa context vars: // - GLcontext *glCtx; // The core Mesa context - GLvisual *glVis; // Describes the color buffer - GLframebuffer *glBuffer; // Ancillary buffers + struct gl_context *glCtx; // The core Mesa context + struct gl_config *glVis; // Describes the color buffer + struct gl_framebuffer *glBuffer; // Ancillary buffers GLuint ClearIndex; GLuint CurrentIndex; diff --git a/src/mesa/drivers/windows/gldirect/dglwgl.c b/src/mesa/drivers/windows/gldirect/dglwgl.c index 74ecb01a5b..c46cfe162f 100644 --- a/src/mesa/drivers/windows/gldirect/dglwgl.c +++ b/src/mesa/drivers/windows/gldirect/dglwgl.c @@ -874,8 +874,8 @@ BOOL APIENTRY _GLD_WGL_EXPORT(SetPixelFormat)( // Copied from GLD2.x. KeithH // static GLboolean _gldShareLists( - GLcontext *ctx1, - GLcontext *ctx2) + struct gl_context *ctx1, + struct gl_context *ctx2) { /* Sanity check context pointers */ if (ctx1 == NULL || ctx2 == NULL) @@ -955,7 +955,7 @@ BOOL APIENTRY _GLD_WGL_EXPORT(SwapLayerBuffers)( // either MESA glViewport() or GLD wglMakeCurrent(). BOOL dglWglResizeBuffers( - GLcontext *ctx, + struct gl_context *ctx, BOOL bDefaultDriver) { DGL_ctx *dgl = NULL; diff --git a/src/mesa/drivers/windows/gldirect/dglwgl.h b/src/mesa/drivers/windows/gldirect/dglwgl.h index aac0410333..3e7e5892ca 100644 --- a/src/mesa/drivers/windows/gldirect/dglwgl.h +++ b/src/mesa/drivers/windows/gldirect/dglwgl.h @@ -118,7 +118,7 @@ BOOL APIENTRY DGL_UseFontOutlinesA(HDC a, DWORD b, DWORD c, DWORD d, FLOAT e, FL BOOL APIENTRY DGL_UseFontOutlinesW(HDC a, DWORD b, DWORD c, DWORD d, FLOAT e, FLOAT f, int g, LPGLYPHMETRICSFLOAT h); #endif //_USE_GLD3_WGL -BOOL dglWglResizeBuffers(GLcontext *ctx, BOOL bDefaultDriver); +BOOL dglWglResizeBuffers(struct gl_context *ctx, BOOL bDefaultDriver); #ifdef __cplusplus } diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_driver_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_driver_dx7.c index 7b202dfda7..1c43a38557 100644 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_driver_dx7.c +++ b/src/mesa/drivers/windows/gldirect/dx7/gld_driver_dx7.c @@ -69,7 +69,7 @@ const float _fPersp_33 = 1.6f; //--------------------------------------------------------------------------- void _gld_mesa_warning( - __GLcontext *gc, + __struct gl_context *gc, char *str) { // Intercept Mesa's internal warning mechanism @@ -79,7 +79,7 @@ void _gld_mesa_warning( //--------------------------------------------------------------------------- void _gld_mesa_fatal( - __GLcontext *gc, + __struct gl_context *gc, char *str) { // Intercept Mesa's internal fatal-message mechanism @@ -199,7 +199,7 @@ D3DBLEND _gldConvertBlendFunc( //--------------------------------------------------------------------------- void gld_Noop_DX7( - GLcontext *ctx) + struct gl_context *ctx) { #ifdef _DEBUG gldLogMessage(GLDLOG_ERROR, "gld_Noop called!\n"); @@ -209,7 +209,7 @@ void gld_Noop_DX7( //--------------------------------------------------------------------------- void gld_Error_DX7( - GLcontext *ctx) + struct gl_context *ctx) { #ifdef _DEBUG // Quite useless. @@ -222,7 +222,7 @@ void gld_Error_DX7( //--------------------------------------------------------------------------- static GLboolean gld_set_draw_buffer_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLenum mode) { (void) ctx; @@ -237,8 +237,8 @@ static GLboolean gld_set_draw_buffer_DX7( //--------------------------------------------------------------------------- static void gld_set_read_buffer_DX7( - GLcontext *ctx, - GLframebuffer *buffer, + struct gl_context *ctx, + struct gl_framebuffer *buffer, GLenum mode) { /* separate read buffer not supported */ @@ -251,7 +251,7 @@ static void gld_set_read_buffer_DX7( //--------------------------------------------------------------------------- void gld_Clear_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLbitfield mask, GLboolean all, GLint x, @@ -342,8 +342,8 @@ void gld_Clear_DX7( // Mesa 5: Parameter change static void gld_buffer_size_DX7( -// GLcontext *ctx, - GLframebuffer *fb, +// struct gl_context *ctx, + struct gl_framebuffer *fb, GLuint *width, GLuint *height) { @@ -356,14 +356,14 @@ static void gld_buffer_size_DX7( //--------------------------------------------------------------------------- static void gld_Finish_DX7( - GLcontext *ctx) + struct gl_context *ctx) { } //--------------------------------------------------------------------------- static void gld_Flush_DX7( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gld = GLD_GET_CONTEXT(ctx); @@ -379,7 +379,7 @@ static void gld_Flush_DX7( //--------------------------------------------------------------------------- void gld_NEW_STENCIL( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); @@ -404,7 +404,7 @@ void gld_NEW_STENCIL( //--------------------------------------------------------------------------- void gld_NEW_COLOR( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); @@ -438,7 +438,7 @@ void gld_NEW_COLOR( //--------------------------------------------------------------------------- void gld_NEW_DEPTH( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); @@ -451,7 +451,7 @@ void gld_NEW_DEPTH( //--------------------------------------------------------------------------- void gld_NEW_POLYGON( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); @@ -516,7 +516,7 @@ void gld_NEW_POLYGON( //--------------------------------------------------------------------------- void gld_NEW_FOG( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); @@ -571,7 +571,7 @@ void gld_NEW_FOG( //--------------------------------------------------------------------------- void gld_NEW_LIGHT( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); @@ -591,7 +591,7 @@ void gld_NEW_LIGHT( //--------------------------------------------------------------------------- void gld_NEW_MODELVIEW( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); @@ -639,7 +639,7 @@ void gld_NEW_MODELVIEW( //--------------------------------------------------------------------------- void gld_NEW_PROJECTION( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); @@ -718,7 +718,7 @@ void gldOrthoHook_DX7( //--------------------------------------------------------------------------- void gld_NEW_VIEWPORT( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); @@ -760,7 +760,7 @@ void gld_NEW_VIEWPORT( //--------------------------------------------------------------------------- __inline BOOL _gldAnyEvalEnabled( - GLcontext *ctx) + struct gl_context *ctx) { struct gl_eval_attrib *eval = &ctx->Eval; @@ -792,7 +792,7 @@ __inline BOOL _gldAnyEvalEnabled( //--------------------------------------------------------------------------- BOOL _gldChooseInternalPipeline( - GLcontext *ctx, + struct gl_context *ctx, GLD_driver_dx7 *gld) { // return TRUE; // DEBUGGING: ALWAYS USE MESA @@ -856,7 +856,7 @@ BOOL _gldChooseInternalPipeline( //--------------------------------------------------------------------------- void gld_update_state_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint new_state) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); @@ -991,7 +991,7 @@ void gld_update_state_DX7( //--------------------------------------------------------------------------- void gld_Viewport_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLint x, GLint y, GLsizei w, @@ -1053,12 +1053,12 @@ void gld_Viewport_DX7( //--------------------------------------------------------------------------- -extern BOOL dglWglResizeBuffers(GLcontext *ctx, BOOL bDefaultDriver); +extern BOOL dglWglResizeBuffers(struct gl_context *ctx, BOOL bDefaultDriver); // Mesa 5: Parameter change void gldResizeBuffers_DX7( -// GLcontext *ctx) - GLframebuffer *fb) +// struct gl_context *ctx) + struct gl_framebuffer *fb) { GET_CURRENT_CONTEXT(ctx); dglWglResizeBuffers(ctx, TRUE); @@ -1069,7 +1069,7 @@ void gldResizeBuffers_DX7( // This is only for debugging. // To use, plug into ctx->Driver.Enable pointer below. void gld_Enable( - GLcontext *ctx, + struct gl_context *ctx, GLenum e, GLboolean b) { @@ -1082,10 +1082,10 @@ void gld_Enable( // Driver pointer setup //--------------------------------------------------------------------------- -extern const GLubyte* _gldGetStringGeneric(GLcontext*, GLenum); +extern const GLubyte* _gldGetStringGeneric(struct gl_context*, GLenum); void gldSetupDriverPointers_DX7( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_dx7.h b/src/mesa/drivers/windows/gldirect/dx7/gld_dx7.h index b5a491e41b..2e1d136568 100644 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_dx7.h +++ b/src/mesa/drivers/windows/gldirect/dx7/gld_dx7.h @@ -225,68 +225,68 @@ typedef struct { //--------------------------------------------------------------------------- PROC gldGetProcAddress_DX7(LPCSTR a); -void gldEnableExtensions_DX7(GLcontext *ctx); -void gldInstallPipeline_DX7(GLcontext *ctx); -void gldSetupDriverPointers_DX7(GLcontext *ctx); -void gldResizeBuffers_DX7(GLframebuffer *fb); +void gldEnableExtensions_DX7(struct gl_context *ctx); +void gldInstallPipeline_DX7(struct gl_context *ctx); +void gldSetupDriverPointers_DX7(struct gl_context *ctx); +void gldResizeBuffers_DX7(struct gl_framebuffer *fb); // Texture functions -void gldCopyTexImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border); -void gldCopyTexImage2D_DX7(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -void gldCopyTexSubImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ); -void gldCopyTexSubImage2D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ); -void gldCopyTexSubImage3D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); - -void gld_NEW_TEXTURE_DX7(GLcontext *ctx); -void gld_DrawPixels_DX7(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels); -void gld_ReadPixels_DX7(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest); -void gld_CopyPixels_DX7(GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type); -void gld_Bitmap_DX7(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap); -const struct gl_texture_format* gld_ChooseTextureFormat_DX7(GLcontext *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType); -void gld_TexImage2D_DX7(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 *tObj, struct gl_texture_image *texImage); -void gld_TexImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, 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 ); -void gld_TexSubImage2D_DX7( 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 ); -void gld_TexSubImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); -void gld_DeleteTexture_DX7(GLcontext *ctx, struct gl_texture_object *tObj); -void gld_ResetLineStipple_DX7(GLcontext *ctx); +void gldCopyTexImage1D_DX7(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border); +void gldCopyTexImage2D_DX7(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +void gldCopyTexSubImage1D_DX7(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ); +void gldCopyTexSubImage2D_DX7(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ); +void gldCopyTexSubImage3D_DX7(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); + +void gld_NEW_TEXTURE_DX7(struct gl_context *ctx); +void gld_DrawPixels_DX7(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels); +void gld_ReadPixels_DX7(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest); +void gld_CopyPixels_DX7(struct gl_context *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type); +void gld_Bitmap_DX7(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap); +const struct gl_texture_format* gld_ChooseTextureFormat_DX7(struct gl_context *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType); +void gld_TexImage2D_DX7(struct gl_context *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 *tObj, struct gl_texture_image *texImage); +void gld_TexImage1D_DX7(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, 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 ); +void gld_TexSubImage2D_DX7( struct gl_context *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 ); +void gld_TexSubImage1D_DX7(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); +void gld_DeleteTexture_DX7(struct gl_context *ctx, struct gl_texture_object *tObj); +void gld_ResetLineStipple_DX7(struct gl_context *ctx); // 2D primitive functions -void gld_Points2D_DX7(GLcontext *ctx, GLuint first, GLuint last); +void gld_Points2D_DX7(struct gl_context *ctx, GLuint first, GLuint last); -void gld_Line2DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Line2DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1); +void gld_Line2DFlat_DX7(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Line2DSmooth_DX7(struct gl_context *ctx, GLuint v0, GLuint v1); -void gld_Triangle2DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DFlatExtras_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DSmoothExtras_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DFlat_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DSmooth_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DFlatExtras_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DSmoothExtras_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad2DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DFlatExtras_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DSmoothExtras_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DFlat_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DSmooth_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DFlatExtras_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DSmoothExtras_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); // 3D primitive functions -void gld_Points3D_DX7(GLcontext *ctx, GLuint first, GLuint last); -void gld_Line3DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Triangle3DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad3DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Line3DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Triangle3DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad3DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Points3D_DX7(struct gl_context *ctx, GLuint first, GLuint last); +void gld_Line3DFlat_DX7(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Triangle3DFlat_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Quad3DFlat_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Line3DSmooth_DX7(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Triangle3DSmooth_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Quad3DSmooth_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); // Primitive functions for Two-sided-lighting Vertex Shader -void gld_Points2DTwoside_DX7(GLcontext *ctx, GLuint first, GLuint last); -void gld_Line2DFlatTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Line2DSmoothTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Triangle2DFlatTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DSmoothTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad2DFlatTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DSmoothTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Points2DTwoside_DX7(struct gl_context *ctx, GLuint first, GLuint last); +void gld_Line2DFlatTwoside_DX7(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Line2DSmoothTwoside_DX7(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Triangle2DFlatTwoside_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DSmoothTwoside_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Quad2DFlatTwoside_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DSmoothTwoside_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); #endif diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_ext_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_ext_dx7.c index ba60980bbe..4ed3c3ca05 100644 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_ext_dx7.c +++ b/src/mesa/drivers/windows/gldirect/dx7/gld_ext_dx7.c @@ -69,7 +69,7 @@ #include "extensions.h" // For some reason this is not defined in an above header... -extern void _mesa_enable_imaging_extensions(GLcontext *ctx); +extern void _mesa_enable_imaging_extensions(struct gl_context *ctx); //--------------------------------------------------------------------------- // Hack for the SGIS_multitexture extension that was removed from Mesa @@ -281,7 +281,7 @@ PROC gldGetProcAddress_DX( //--------------------------------------------------------------------------- void gldEnableExtensions_DX7( - GLcontext *ctx) + struct gl_context *ctx) { GLuint i; diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_pipeline_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_pipeline_dx7.c index 9ccec69b98..b801542736 100644 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_pipeline_dx7.c +++ b/src/mesa/drivers/windows/gldirect/dx7/gld_pipeline_dx7.c @@ -65,7 +65,7 @@ static const struct tnl_pipeline_stage *gld_pipeline[] = { //--------------------------------------------------------------------------- void gldInstallPipeline_DX7( - GLcontext *ctx) + struct gl_context *ctx) { // Remove any existing pipeline stages, // then install GLDirect pipeline stages. diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c index 0b373814fe..7fc50004de 100644 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c +++ b/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c @@ -277,7 +277,7 @@ //--------------------------------------------------------------------------- __inline DWORD _gldComputeFog( - GLcontext *ctx, + struct gl_context *ctx, SWvertex *swv) { // Full fog calculation. @@ -300,7 +300,7 @@ __inline DWORD _gldComputeFog( //--------------------------------------------------------------------------- void gld_ResetLineStipple_DX7( - GLcontext *ctx) + struct gl_context *ctx) { // TODO: Fake stipple with a 32x32 texture. } @@ -310,7 +310,7 @@ void gld_ResetLineStipple_DX7( //--------------------------------------------------------------------------- void gld_Points2D_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint first, GLuint last) { @@ -358,7 +358,7 @@ void gld_Points2D_DX7( //--------------------------------------------------------------------------- void gld_Line2DFlat_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1) { @@ -391,7 +391,7 @@ void gld_Line2DFlat_DX7( //--------------------------------------------------------------------------- void gld_Line2DSmooth_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1) { @@ -422,7 +422,7 @@ void gld_Line2DSmooth_DX7( //--------------------------------------------------------------------------- void gld_Triangle2DFlat_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -461,7 +461,7 @@ void gld_Triangle2DFlat_DX7( //--------------------------------------------------------------------------- void gld_Triangle2DSmooth_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -500,7 +500,7 @@ void gld_Triangle2DSmooth_DX7( //--------------------------------------------------------------------------- void gld_Triangle2DFlatExtras_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -549,7 +549,7 @@ void gld_Triangle2DFlatExtras_DX7( //--------------------------------------------------------------------------- void gld_Triangle2DSmoothExtras_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -589,7 +589,7 @@ void gld_Triangle2DSmoothExtras_DX7( //--------------------------------------------------------------------------- void gld_Quad2DFlat_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -653,7 +653,7 @@ void gld_Quad2DFlat_DX7( //--------------------------------------------------------------------------- void gld_Quad2DSmooth_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -716,7 +716,7 @@ void gld_Quad2DSmooth_DX7( //--------------------------------------------------------------------------- void gld_Quad2DFlatExtras_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -793,7 +793,7 @@ void gld_Quad2DFlatExtras_DX7( //--------------------------------------------------------------------------- void gld_Quad2DSmoothExtras_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -860,7 +860,7 @@ void gld_Quad2DSmoothExtras_DX7( //--------------------------------------------------------------------------- void gld_Points3D_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint first, GLuint last) { @@ -913,7 +913,7 @@ void gld_Points3D_DX7( //--------------------------------------------------------------------------- void gld_Line3DFlat_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1) { @@ -939,7 +939,7 @@ void gld_Line3DFlat_DX7( //--------------------------------------------------------------------------- void gld_Line3DSmooth_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1) { @@ -966,7 +966,7 @@ void gld_Line3DSmooth_DX7( //--------------------------------------------------------------------------- void gld_Triangle3DFlat_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -999,7 +999,7 @@ void gld_Triangle3DFlat_DX7( //--------------------------------------------------------------------------- void gld_Triangle3DSmooth_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -1033,7 +1033,7 @@ void gld_Triangle3DSmooth_DX7( //--------------------------------------------------------------------------- void gld_Quad3DFlat_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -1085,7 +1085,7 @@ void gld_Quad3DFlat_DX7( //--------------------------------------------------------------------------- void gld_Quad3DSmooth_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -1139,34 +1139,34 @@ void gld_Quad3DSmooth_DX7( /* -void gld_Points2DTwoside_DX8(GLcontext *ctx, GLuint first, GLuint last) +void gld_Points2DTwoside_DX8(struct gl_context *ctx, GLuint first, GLuint last) { // NOTE: Two-sided lighting does not apply to Points } //--------------------------------------------------------------------------- -void gld_Line2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1) +void gld_Line2DFlatTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1) { // NOTE: Two-sided lighting does not apply to Lines } //--------------------------------------------------------------------------- -void gld_Line2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1) +void gld_Line2DSmoothTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1) { // NOTE: Two-sided lighting does not apply to Lines } //--------------------------------------------------------------------------- -void gld_Triangle2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2) +void gld_Triangle2DFlatTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) { } //--------------------------------------------------------------------------- -void gld_Triangle2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2) +void gld_Triangle2DSmoothTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); @@ -1231,7 +1231,7 @@ void gld_Triangle2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuin //--------------------------------------------------------------------------- -void gld_Quad2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) +void gld_Quad2DFlatTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); @@ -1338,7 +1338,7 @@ void gld_Quad2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, //--------------------------------------------------------------------------- -void gld_Quad2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) +void gld_Quad2DSmoothTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_texture_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_texture_dx7.c index bbe673516d..74c3b0d344 100644 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_texture_dx7.c +++ b/src/mesa/drivers/windows/gldirect/dx7/gld_texture_dx7.c @@ -817,7 +817,7 @@ void _gldClearSurface( //--------------------------------------------------------------------------- void gldCopyTexImage1D_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, @@ -829,7 +829,7 @@ void gldCopyTexImage1D_DX7( //--------------------------------------------------------------------------- void gldCopyTexImage2D_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, @@ -845,7 +845,7 @@ void gldCopyTexImage2D_DX7( //--------------------------------------------------------------------------- void gldCopyTexSubImage1D_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ) { @@ -855,7 +855,7 @@ void gldCopyTexSubImage1D_DX7( //--------------------------------------------------------------------------- void gldCopyTexSubImage2D_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, @@ -871,7 +871,7 @@ void gldCopyTexSubImage2D_DX7( //--------------------------------------------------------------------------- void gldCopyTexSubImage3D_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, @@ -903,7 +903,7 @@ typedef struct { //--------------------------------------------------------------------------- HRESULT _gldDrawPixels( - GLcontext *ctx, + struct gl_context *ctx, BOOL bChromakey, // Alpha test for glBitmap() images GLint x, // GL x position GLint y, // GL y position (needs flipping) @@ -1009,7 +1009,7 @@ HRESULT _gldDrawPixels( //--------------------------------------------------------------------------- void gld_DrawPixels_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, @@ -1086,7 +1086,7 @@ void gld_DrawPixels_DX7( //--------------------------------------------------------------------------- void gld_ReadPixels_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *pack, @@ -1241,7 +1241,7 @@ gld_ReadPixels_DX7_return: //--------------------------------------------------------------------------- void gld_CopyPixels_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLint srcx, GLint srcy, GLsizei width, @@ -1330,7 +1330,7 @@ void gld_CopyPixels_DX7( //--------------------------------------------------------------------------- void gld_Bitmap_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLint x, GLint y, GLsizei width, @@ -1475,7 +1475,7 @@ void gld_Bitmap_DX7( //--------------------------------------------------------------------------- void _gldAllocateTexture( - GLcontext *ctx, + struct gl_context *ctx, struct gl_texture_object *tObj, struct gl_texture_image *texImage) { @@ -1533,7 +1533,7 @@ void _gldAllocateTexture( //--------------------------------------------------------------------------- const struct gl_texture_format* gld_ChooseTextureFormat_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType) @@ -1622,7 +1622,7 @@ const struct gl_texture_format* gld_ChooseTextureFormat_DX7( /* // Safer(?), slower version. void gld_TexImage2D_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, @@ -1700,7 +1700,7 @@ void gld_TexImage2D_DX7( // Faster, more efficient version. // Copies subimage straight to dest texture void gld_TexImage2D_DX7( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, @@ -1792,7 +1792,7 @@ void gld_TexImage2D_DX7( //--------------------------------------------------------------------------- -void gld_TexImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, +void gld_TexImage1D_DX7(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -1807,7 +1807,7 @@ void gld_TexImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, //--------------------------------------------------------------------------- /* -void gld_TexSubImage2D( GLcontext *ctx, GLenum target, GLint level, +void gld_TexSubImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -1883,7 +1883,7 @@ void gld_TexSubImage2D( GLcontext *ctx, GLenum target, GLint level, // Faster, more efficient version. // Copies subimage straight to dest texture -void gld_TexSubImage2D_DX7( GLcontext *ctx, GLenum target, GLint level, +void gld_TexSubImage2D_DX7( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -1963,7 +1963,7 @@ void gld_TexSubImage2D_DX7( GLcontext *ctx, GLenum target, GLint level, //--------------------------------------------------------------------------- -void gld_TexSubImage1D_DX7( GLcontext *ctx, GLenum target, GLint level, +void gld_TexSubImage1D_DX7( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, @@ -1977,7 +1977,7 @@ void gld_TexSubImage1D_DX7( GLcontext *ctx, GLenum target, GLint level, //--------------------------------------------------------------------------- void gld_DeleteTexture_DX7( - GLcontext *ctx, + struct gl_context *ctx, struct gl_texture_object *tObj) { GLD_context *gld = (GLD_context*)(ctx->DriverCtx); @@ -2036,7 +2036,7 @@ __inline void _gldSetAlphaOps( //--------------------------------------------------------------------------- void gldUpdateTextureUnit( - GLcontext *ctx, + struct gl_context *ctx, GLuint unit, BOOL bPassThrough) { @@ -2145,7 +2145,7 @@ void gldUpdateTextureUnit( //--------------------------------------------------------------------------- void gld_NEW_TEXTURE_DX7( - GLcontext *ctx) + struct gl_context *ctx) { // TODO: Support for three (ATI Radeon) or more (nVidia GeForce3) texture units diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c index c39775cad3..0a1b9479ef 100644 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c +++ b/src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c @@ -61,7 +61,7 @@ //--------------------------------------------------------------------------- /* __inline void _gldSetVertexShaderConstants( - GLcontext *ctx, + struct gl_context *ctx, GLD_driver_dx8 *gld) { D3DXMATRIX mat, matView, matProj; @@ -116,7 +116,7 @@ __inline void _gldSetVertexShaderConstants( //--------------------------------------------------------------------------- static GLboolean gld_d3d_render_stage_run( - GLcontext *ctx, + struct gl_context *ctx, struct tnl_pipeline_stage *stage) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_vb_mesa_render_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_vb_mesa_render_dx7.c index 72e5e1308c..a8356c0a20 100644 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_vb_mesa_render_dx7.c +++ b/src/mesa/drivers/windows/gldirect/dx7/gld_vb_mesa_render_dx7.c @@ -167,7 +167,7 @@ do { \ /* TODO: do this for all primitives, verts and elts: */ -static void clip_elt_triangles( GLcontext *ctx, +static void clip_elt_triangles( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -255,7 +255,7 @@ static void clip_elt_triangles( GLcontext *ctx, /* Helper functions for drivers */ /**********************************************************************/ /* -void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n ) +void _tnl_RenderClippedPolygon( struct gl_context *ctx, const GLuint *elts, GLuint n ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; @@ -266,7 +266,7 @@ void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n ) VB->Elts = tmp; } -void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) +void _tnl_RenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->Driver.Render.Line( ctx, ii, jj ); @@ -306,7 +306,7 @@ tnl_quad_func _gldSetupQuad[4] = { //--------------------------------------------------------------------------- static GLboolean _gld_mesa_render_stage_run( - GLcontext *ctx, + struct gl_context *ctx, struct tnl_pipeline_stage *stage) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_wgl_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_wgl_dx7.c index fa44a952a0..0d860dbe1a 100644 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_wgl_dx7.c +++ b/src/mesa/drivers/windows/gldirect/dx7/gld_wgl_dx7.c @@ -57,8 +57,8 @@ extern int nContextError; #define DDLOG_CRITICAL_OR_WARN DDLOG_CRITICAL -extern void _gld_mesa_warning(GLcontext *, char *); -extern void _gld_mesa_fatal(GLcontext *, char *); +extern void _gld_mesa_warning(struct gl_context *, char *); +extern void _gld_mesa_fatal(struct gl_context *, char *); //--------------------------------------------------------------------------- @@ -243,7 +243,7 @@ void _gldDestroyPrimitiveBuffer( //--------------------------------------------------------------------------- HRESULT _gldCreatePrimitiveBuffer( - GLcontext *ctx, + struct gl_context *ctx, GLD_driver_dx7 *lpCtx, GLD_pb_dx7 *gldVB) { diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_driver_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_driver_dx8.c index 7eeb9db2d1..c4c2e0b567 100644 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_driver_dx8.c +++ b/src/mesa/drivers/windows/gldirect/dx8/gld_driver_dx8.c @@ -69,7 +69,7 @@ const float _fPersp_33 = 1.6f; //--------------------------------------------------------------------------- void _gld_mesa_warning( - __GLcontext *gc, + __struct gl_context *gc, char *str) { // Intercept Mesa's internal warning mechanism @@ -79,7 +79,7 @@ void _gld_mesa_warning( //--------------------------------------------------------------------------- void _gld_mesa_fatal( - __GLcontext *gc, + __struct gl_context *gc, char *str) { // Intercept Mesa's internal fatal-message mechanism @@ -199,7 +199,7 @@ D3DBLEND _gldConvertBlendFunc( //--------------------------------------------------------------------------- void gld_Noop_DX8( - GLcontext *ctx) + struct gl_context *ctx) { #ifdef _DEBUG gldLogMessage(GLDLOG_ERROR, "gld_Noop called!\n"); @@ -209,7 +209,7 @@ void gld_Noop_DX8( //--------------------------------------------------------------------------- void gld_Error_DX8( - GLcontext *ctx) + struct gl_context *ctx) { #ifdef _DEBUG // Quite useless. @@ -222,7 +222,7 @@ void gld_Error_DX8( //--------------------------------------------------------------------------- static GLboolean gld_set_draw_buffer_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLenum mode) { (void) ctx; @@ -237,8 +237,8 @@ static GLboolean gld_set_draw_buffer_DX8( //--------------------------------------------------------------------------- static void gld_set_read_buffer_DX8( - GLcontext *ctx, - GLframebuffer *buffer, + struct gl_context *ctx, + struct gl_framebuffer *buffer, GLenum mode) { /* separate read buffer not supported */ @@ -251,7 +251,7 @@ static void gld_set_read_buffer_DX8( //--------------------------------------------------------------------------- void gld_Clear_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLbitfield mask, GLboolean all, GLint x, @@ -342,8 +342,8 @@ void gld_Clear_DX8( // Mesa 5: Parameter change static void gld_buffer_size_DX8( -// GLcontext *ctx, - GLframebuffer *fb, +// struct gl_context *ctx, + struct gl_framebuffer *fb, GLuint *width, GLuint *height) { @@ -356,14 +356,14 @@ static void gld_buffer_size_DX8( //--------------------------------------------------------------------------- static void gld_Finish_DX8( - GLcontext *ctx) + struct gl_context *ctx) { } //--------------------------------------------------------------------------- static void gld_Flush_DX8( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gld = GLD_GET_CONTEXT(ctx); @@ -379,7 +379,7 @@ static void gld_Flush_DX8( //--------------------------------------------------------------------------- void gld_NEW_STENCIL( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); @@ -404,7 +404,7 @@ void gld_NEW_STENCIL( //--------------------------------------------------------------------------- void gld_NEW_COLOR( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); @@ -436,7 +436,7 @@ void gld_NEW_COLOR( //--------------------------------------------------------------------------- void gld_NEW_DEPTH( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); @@ -449,7 +449,7 @@ void gld_NEW_DEPTH( //--------------------------------------------------------------------------- void gld_NEW_POLYGON( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); @@ -514,7 +514,7 @@ void gld_NEW_POLYGON( //--------------------------------------------------------------------------- void gld_NEW_FOG( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); @@ -569,7 +569,7 @@ void gld_NEW_FOG( //--------------------------------------------------------------------------- void gld_NEW_LIGHT( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); @@ -589,7 +589,7 @@ void gld_NEW_LIGHT( //--------------------------------------------------------------------------- void gld_NEW_MODELVIEW( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); @@ -621,7 +621,7 @@ void gld_NEW_MODELVIEW( //--------------------------------------------------------------------------- void gld_NEW_PROJECTION( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); @@ -700,7 +700,7 @@ void gldOrthoHook_DX8( //--------------------------------------------------------------------------- void gld_NEW_VIEWPORT( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); @@ -742,7 +742,7 @@ void gld_NEW_VIEWPORT( //--------------------------------------------------------------------------- __inline BOOL _gldAnyEvalEnabled( - GLcontext *ctx) + struct gl_context *ctx) { struct gl_eval_attrib *eval = &ctx->Eval; @@ -774,7 +774,7 @@ __inline BOOL _gldAnyEvalEnabled( //--------------------------------------------------------------------------- BOOL _gldChooseInternalPipeline( - GLcontext *ctx, + struct gl_context *ctx, GLD_driver_dx8 *gld) { // return TRUE; // DEBUGGING: ALWAYS USE MESA @@ -838,7 +838,7 @@ BOOL _gldChooseInternalPipeline( //--------------------------------------------------------------------------- void gld_update_state_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint new_state) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); @@ -971,7 +971,7 @@ void gld_update_state_DX8( //--------------------------------------------------------------------------- void gld_Viewport_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLint x, GLint y, GLsizei w, @@ -1033,12 +1033,12 @@ void gld_Viewport_DX8( //--------------------------------------------------------------------------- -extern BOOL dglWglResizeBuffers(GLcontext *ctx, BOOL bDefaultDriver); +extern BOOL dglWglResizeBuffers(struct gl_context *ctx, BOOL bDefaultDriver); // Mesa 5: Parameter change void gldResizeBuffers_DX8( -// GLcontext *ctx) - GLframebuffer *fb) +// struct gl_context *ctx) + struct gl_framebuffer *fb) { GET_CURRENT_CONTEXT(ctx); dglWglResizeBuffers(ctx, TRUE); @@ -1049,7 +1049,7 @@ void gldResizeBuffers_DX8( // This is only for debugging. // To use, plug into ctx->Driver.Enable pointer below. void gld_Enable( - GLcontext *ctx, + struct gl_context *ctx, GLenum e, GLboolean b) { @@ -1062,10 +1062,10 @@ void gld_Enable( // Driver pointer setup //--------------------------------------------------------------------------- -extern const GLubyte* _gldGetStringGeneric(GLcontext*, GLenum); +extern const GLubyte* _gldGetStringGeneric(struct gl_context*, GLenum); void gldSetupDriverPointers_DX8( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_dx8.h b/src/mesa/drivers/windows/gldirect/dx8/gld_dx8.h index 7efec7cae8..b207ecc788 100644 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_dx8.h +++ b/src/mesa/drivers/windows/gldirect/dx8/gld_dx8.h @@ -256,69 +256,69 @@ typedef struct { //--------------------------------------------------------------------------- PROC gldGetProcAddress_DX8(LPCSTR a); -void gldEnableExtensions_DX8(GLcontext *ctx); -void gldInstallPipeline_DX8(GLcontext *ctx); -void gldSetupDriverPointers_DX8(GLcontext *ctx); -//void gldResizeBuffers_DX8(GLcontext *ctx); -void gldResizeBuffers_DX8(GLframebuffer *fb); +void gldEnableExtensions_DX8(struct gl_context *ctx); +void gldInstallPipeline_DX8(struct gl_context *ctx); +void gldSetupDriverPointers_DX8(struct gl_context *ctx); +//void gldResizeBuffers_DX8(struct gl_context *ctx); +void gldResizeBuffers_DX8(struct gl_framebuffer *fb); // Texture functions -void gldCopyTexImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border); -void gldCopyTexImage2D_DX8(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -void gldCopyTexSubImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ); -void gldCopyTexSubImage2D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ); -void gldCopyTexSubImage3D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); - -void gld_NEW_TEXTURE_DX8(GLcontext *ctx); -void gld_DrawPixels_DX8(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels); -void gld_ReadPixels_DX8(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest); -void gld_CopyPixels_DX8(GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type); -void gld_Bitmap_DX8(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap); -const struct gl_texture_format* gld_ChooseTextureFormat_DX8(GLcontext *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType); -void gld_TexImage2D_DX8(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 *tObj, struct gl_texture_image *texImage); -void gld_TexImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, 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 ); -void gld_TexSubImage2D_DX8( 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 ); -void gld_TexSubImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); -void gld_DeleteTexture_DX8(GLcontext *ctx, struct gl_texture_object *tObj); -void gld_ResetLineStipple_DX8(GLcontext *ctx); +void gldCopyTexImage1D_DX8(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border); +void gldCopyTexImage2D_DX8(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +void gldCopyTexSubImage1D_DX8(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ); +void gldCopyTexSubImage2D_DX8(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ); +void gldCopyTexSubImage3D_DX8(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); + +void gld_NEW_TEXTURE_DX8(struct gl_context *ctx); +void gld_DrawPixels_DX8(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels); +void gld_ReadPixels_DX8(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest); +void gld_CopyPixels_DX8(struct gl_context *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type); +void gld_Bitmap_DX8(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap); +const struct gl_texture_format* gld_ChooseTextureFormat_DX8(struct gl_context *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType); +void gld_TexImage2D_DX8(struct gl_context *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 *tObj, struct gl_texture_image *texImage); +void gld_TexImage1D_DX8(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, 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 ); +void gld_TexSubImage2D_DX8( struct gl_context *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 ); +void gld_TexSubImage1D_DX8(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); +void gld_DeleteTexture_DX8(struct gl_context *ctx, struct gl_texture_object *tObj); +void gld_ResetLineStipple_DX8(struct gl_context *ctx); // 2D primitive functions -void gld_Points2D_DX8(GLcontext *ctx, GLuint first, GLuint last); +void gld_Points2D_DX8(struct gl_context *ctx, GLuint first, GLuint last); -void gld_Line2DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Line2DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1); +void gld_Line2DFlat_DX8(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Line2DSmooth_DX8(struct gl_context *ctx, GLuint v0, GLuint v1); -void gld_Triangle2DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DFlatExtras_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DSmoothExtras_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DFlat_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DSmooth_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DFlatExtras_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DSmoothExtras_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad2DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DFlatExtras_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DSmoothExtras_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DFlat_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DSmooth_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DFlatExtras_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DSmoothExtras_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); // 3D primitive functions -void gld_Points3D_DX8(GLcontext *ctx, GLuint first, GLuint last); -void gld_Line3DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Triangle3DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad3DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Line3DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Triangle3DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad3DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Points3D_DX8(struct gl_context *ctx, GLuint first, GLuint last); +void gld_Line3DFlat_DX8(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Triangle3DFlat_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Quad3DFlat_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Line3DSmooth_DX8(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Triangle3DSmooth_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Quad3DSmooth_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); // Primitive functions for Two-sided-lighting Vertex Shader -void gld_Points2DTwoside_DX8(GLcontext *ctx, GLuint first, GLuint last); -void gld_Line2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Line2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Triangle2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Points2DTwoside_DX8(struct gl_context *ctx, GLuint first, GLuint last); +void gld_Line2DFlatTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Line2DSmoothTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Triangle2DFlatTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DSmoothTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Quad2DFlatTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DSmoothTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); #endif diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_ext_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_ext_dx8.c index b51bba9b3c..9218945805 100644 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_ext_dx8.c +++ b/src/mesa/drivers/windows/gldirect/dx8/gld_ext_dx8.c @@ -69,7 +69,7 @@ #include "extensions.h" // For some reason this is not defined in an above header... -extern void _mesa_enable_imaging_extensions(GLcontext *ctx); +extern void _mesa_enable_imaging_extensions(struct gl_context *ctx); //--------------------------------------------------------------------------- // Hack for the SGIS_multitexture extension that was removed from Mesa @@ -281,7 +281,7 @@ PROC gldGetProcAddress_DX( //--------------------------------------------------------------------------- void gldEnableExtensions_DX8( - GLcontext *ctx) + struct gl_context *ctx) { GLuint i; diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_pipeline_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_pipeline_dx8.c index 2baea57443..9113d70345 100644 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_pipeline_dx8.c +++ b/src/mesa/drivers/windows/gldirect/dx8/gld_pipeline_dx8.c @@ -65,7 +65,7 @@ static const struct tnl_pipeline_stage *gld_pipeline[] = { //--------------------------------------------------------------------------- void gldInstallPipeline_DX8( - GLcontext *ctx) + struct gl_context *ctx) { // Remove any existing pipeline stages, // then install GLDirect pipeline stages. diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c index 990922580a..5b9dac09c6 100644 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c +++ b/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c @@ -277,7 +277,7 @@ //--------------------------------------------------------------------------- __inline DWORD _gldComputeFog( - GLcontext *ctx, + struct gl_context *ctx, SWvertex *swv) { // Full fog calculation. @@ -300,7 +300,7 @@ __inline DWORD _gldComputeFog( //--------------------------------------------------------------------------- void gld_ResetLineStipple_DX8( - GLcontext *ctx) + struct gl_context *ctx) { // TODO: Fake stipple with a 32x32 texture. } @@ -310,7 +310,7 @@ void gld_ResetLineStipple_DX8( //--------------------------------------------------------------------------- void gld_Points2D_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint first, GLuint last) { @@ -357,7 +357,7 @@ void gld_Points2D_DX8( //--------------------------------------------------------------------------- void gld_Line2DFlat_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1) { @@ -390,7 +390,7 @@ void gld_Line2DFlat_DX8( //--------------------------------------------------------------------------- void gld_Line2DSmooth_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1) { @@ -421,7 +421,7 @@ void gld_Line2DSmooth_DX8( //--------------------------------------------------------------------------- void gld_Triangle2DFlat_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -460,7 +460,7 @@ void gld_Triangle2DFlat_DX8( //--------------------------------------------------------------------------- void gld_Triangle2DSmooth_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -499,7 +499,7 @@ void gld_Triangle2DSmooth_DX8( //--------------------------------------------------------------------------- void gld_Triangle2DFlatExtras_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -548,7 +548,7 @@ void gld_Triangle2DFlatExtras_DX8( //--------------------------------------------------------------------------- void gld_Triangle2DSmoothExtras_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -588,7 +588,7 @@ void gld_Triangle2DSmoothExtras_DX8( //--------------------------------------------------------------------------- void gld_Quad2DFlat_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -652,7 +652,7 @@ void gld_Quad2DFlat_DX8( //--------------------------------------------------------------------------- void gld_Quad2DSmooth_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -715,7 +715,7 @@ void gld_Quad2DSmooth_DX8( //--------------------------------------------------------------------------- void gld_Quad2DFlatExtras_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -792,7 +792,7 @@ void gld_Quad2DFlatExtras_DX8( //--------------------------------------------------------------------------- void gld_Quad2DSmoothExtras_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -859,7 +859,7 @@ void gld_Quad2DSmoothExtras_DX8( //--------------------------------------------------------------------------- void gld_Points3D_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint first, GLuint last) { @@ -911,7 +911,7 @@ void gld_Points3D_DX8( //--------------------------------------------------------------------------- void gld_Line3DFlat_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1) { @@ -937,7 +937,7 @@ void gld_Line3DFlat_DX8( //--------------------------------------------------------------------------- void gld_Line3DSmooth_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1) { @@ -964,7 +964,7 @@ void gld_Line3DSmooth_DX8( //--------------------------------------------------------------------------- void gld_Triangle3DFlat_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -997,7 +997,7 @@ void gld_Triangle3DFlat_DX8( //--------------------------------------------------------------------------- void gld_Triangle3DSmooth_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -1031,7 +1031,7 @@ void gld_Triangle3DSmooth_DX8( //--------------------------------------------------------------------------- void gld_Quad3DFlat_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -1083,7 +1083,7 @@ void gld_Quad3DFlat_DX8( //--------------------------------------------------------------------------- void gld_Quad3DSmooth_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -1137,34 +1137,34 @@ void gld_Quad3DSmooth_DX8( /* -void gld_Points2DTwoside_DX8(GLcontext *ctx, GLuint first, GLuint last) +void gld_Points2DTwoside_DX8(struct gl_context *ctx, GLuint first, GLuint last) { // NOTE: Two-sided lighting does not apply to Points } //--------------------------------------------------------------------------- -void gld_Line2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1) +void gld_Line2DFlatTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1) { // NOTE: Two-sided lighting does not apply to Lines } //--------------------------------------------------------------------------- -void gld_Line2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1) +void gld_Line2DSmoothTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1) { // NOTE: Two-sided lighting does not apply to Lines } //--------------------------------------------------------------------------- -void gld_Triangle2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2) +void gld_Triangle2DFlatTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) { } //--------------------------------------------------------------------------- -void gld_Triangle2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2) +void gld_Triangle2DSmoothTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); @@ -1229,7 +1229,7 @@ void gld_Triangle2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuin //--------------------------------------------------------------------------- -void gld_Quad2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) +void gld_Quad2DFlatTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); @@ -1336,7 +1336,7 @@ void gld_Quad2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, //--------------------------------------------------------------------------- -void gld_Quad2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) +void gld_Quad2DSmoothTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_texture_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_texture_dx8.c index f24b3cfb74..6ea670a88a 100644 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_texture_dx8.c +++ b/src/mesa/drivers/windows/gldirect/dx8/gld_texture_dx8.c @@ -760,7 +760,7 @@ const struct gl_texture_format* _gldMesaFormatForD3DFormat( //--------------------------------------------------------------------------- void gldCopyTexImage1D_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, @@ -772,7 +772,7 @@ void gldCopyTexImage1D_DX8( //--------------------------------------------------------------------------- void gldCopyTexImage2D_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, @@ -788,7 +788,7 @@ void gldCopyTexImage2D_DX8( //--------------------------------------------------------------------------- void gldCopyTexSubImage1D_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ) { @@ -798,7 +798,7 @@ void gldCopyTexSubImage1D_DX8( //--------------------------------------------------------------------------- void gldCopyTexSubImage2D_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, @@ -814,7 +814,7 @@ void gldCopyTexSubImage2D_DX8( //--------------------------------------------------------------------------- void gldCopyTexSubImage3D_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, @@ -846,7 +846,7 @@ typedef struct { //--------------------------------------------------------------------------- HRESULT _gldDrawPixels( - GLcontext *ctx, + struct gl_context *ctx, BOOL bChromakey, // Alpha test for glBitmap() images GLint x, // GL x position GLint y, // GL y position (needs flipping) @@ -982,7 +982,7 @@ HRESULT _gldDrawPixels( //--------------------------------------------------------------------------- void gld_DrawPixels_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, @@ -1045,7 +1045,7 @@ void gld_DrawPixels_DX8( //--------------------------------------------------------------------------- void gld_ReadPixels_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *pack, @@ -1198,7 +1198,7 @@ gld_ReadPixels_DX8_return: //--------------------------------------------------------------------------- void gld_CopyPixels_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLint srcx, GLint srcy, GLsizei width, @@ -1284,7 +1284,7 @@ void gld_CopyPixels_DX8( //--------------------------------------------------------------------------- void gld_Bitmap_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLint x, GLint y, GLsizei width, @@ -1389,7 +1389,7 @@ void gld_Bitmap_DX8( //--------------------------------------------------------------------------- void _gldAllocateTexture( - GLcontext *ctx, + struct gl_context *ctx, struct gl_texture_object *tObj, struct gl_texture_image *texImage) { @@ -1435,7 +1435,7 @@ void _gldAllocateTexture( //--------------------------------------------------------------------------- const struct gl_texture_format* gld_ChooseTextureFormat_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType) @@ -1524,7 +1524,7 @@ const struct gl_texture_format* gld_ChooseTextureFormat_DX8( /* // Safer(?), slower version. void gld_TexImage2D_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, @@ -1602,7 +1602,7 @@ void gld_TexImage2D_DX8( // Faster, more efficient version. // Copies subimage straight to dest texture void gld_TexImage2D_DX8( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, @@ -1676,7 +1676,7 @@ void gld_TexImage2D_DX8( //--------------------------------------------------------------------------- -void gld_TexImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, +void gld_TexImage1D_DX8(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -1691,7 +1691,7 @@ void gld_TexImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, //--------------------------------------------------------------------------- /* -void gld_TexSubImage2D( GLcontext *ctx, GLenum target, GLint level, +void gld_TexSubImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -1767,7 +1767,7 @@ void gld_TexSubImage2D( GLcontext *ctx, GLenum target, GLint level, // Faster, more efficient version. // Copies subimage straight to dest texture -void gld_TexSubImage2D_DX8( GLcontext *ctx, GLenum target, GLint level, +void gld_TexSubImage2D_DX8( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -1828,7 +1828,7 @@ void gld_TexSubImage2D_DX8( GLcontext *ctx, GLenum target, GLint level, //--------------------------------------------------------------------------- -void gld_TexSubImage1D_DX8( GLcontext *ctx, GLenum target, GLint level, +void gld_TexSubImage1D_DX8( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, @@ -1842,7 +1842,7 @@ void gld_TexSubImage1D_DX8( GLcontext *ctx, GLenum target, GLint level, //--------------------------------------------------------------------------- void gld_DeleteTexture_DX8( - GLcontext *ctx, + struct gl_context *ctx, struct gl_texture_object *tObj) { GLD_context *gld = (GLD_context*)(ctx->DriverCtx); @@ -1894,7 +1894,7 @@ __inline void _gldSetAlphaOps( //--------------------------------------------------------------------------- void gldUpdateTextureUnit( - GLcontext *ctx, + struct gl_context *ctx, GLuint unit, BOOL bPassThrough) { @@ -1994,7 +1994,7 @@ void gldUpdateTextureUnit( //--------------------------------------------------------------------------- void gld_NEW_TEXTURE_DX8( - GLcontext *ctx) + struct gl_context *ctx) { // TODO: Support for three (ATI Radeon) or more (nVidia GeForce3) texture units diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c index 265c81fb4a..983df9bc09 100644 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c +++ b/src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c @@ -61,7 +61,7 @@ //--------------------------------------------------------------------------- __inline void _gldSetVertexShaderConstants( - GLcontext *ctx, + struct gl_context *ctx, GLD_driver_dx8 *gld) { D3DXMATRIX mat, matView, matProj; @@ -116,7 +116,7 @@ __inline void _gldSetVertexShaderConstants( //--------------------------------------------------------------------------- static GLboolean gld_d3d_render_stage_run( - GLcontext *ctx, + struct gl_context *ctx, struct tnl_pipeline_stage *stage) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_vb_mesa_render_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_vb_mesa_render_dx8.c index 9ab562010c..19ffc72c81 100644 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_vb_mesa_render_dx8.c +++ b/src/mesa/drivers/windows/gldirect/dx8/gld_vb_mesa_render_dx8.c @@ -167,7 +167,7 @@ do { \ /* TODO: do this for all primitives, verts and elts: */ -static void clip_elt_triangles( GLcontext *ctx, +static void clip_elt_triangles( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -255,7 +255,7 @@ static void clip_elt_triangles( GLcontext *ctx, /* Helper functions for drivers */ /**********************************************************************/ /* -void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n ) +void _tnl_RenderClippedPolygon( struct gl_context *ctx, const GLuint *elts, GLuint n ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; @@ -266,7 +266,7 @@ void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n ) VB->Elts = tmp; } -void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) +void _tnl_RenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->Driver.Render.Line( ctx, ii, jj ); @@ -306,7 +306,7 @@ tnl_quad_func _gldSetupQuad[4] = { //--------------------------------------------------------------------------- static GLboolean _gld_mesa_render_stage_run( - GLcontext *ctx, + struct gl_context *ctx, struct tnl_pipeline_stage *stage) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_wgl_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_wgl_dx8.c index 011d810e97..73c76c7d4b 100644 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_wgl_dx8.c +++ b/src/mesa/drivers/windows/gldirect/dx8/gld_wgl_dx8.c @@ -54,8 +54,8 @@ extern int nContextError; #define DDLOG_CRITICAL_OR_WARN DDLOG_CRITICAL -extern void _gld_mesa_warning(GLcontext *, char *); -extern void _gld_mesa_fatal(GLcontext *, char *); +extern void _gld_mesa_warning(struct gl_context *, char *); +extern void _gld_mesa_fatal(struct gl_context *, char *); //--------------------------------------------------------------------------- @@ -233,7 +233,7 @@ void _gldDestroyPrimitiveBuffer( //--------------------------------------------------------------------------- HRESULT _gldCreatePrimitiveBuffer( - GLcontext *ctx, + struct gl_context *ctx, GLD_driver_dx8 *lpCtx, GLD_pb_dx8 *gldVB) { diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_driver_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_driver_dx9.c index 0558462dea..aab7085201 100644 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_driver_dx9.c +++ b/src/mesa/drivers/windows/gldirect/dx9/gld_driver_dx9.c @@ -69,7 +69,7 @@ const float _fPersp_33 = 1.6f; //--------------------------------------------------------------------------- void _gld_mesa_warning( - __GLcontext *gc, + __struct gl_context *gc, char *str) { // Intercept Mesa's internal warning mechanism @@ -79,7 +79,7 @@ void _gld_mesa_warning( //--------------------------------------------------------------------------- void _gld_mesa_fatal( - __GLcontext *gc, + __struct gl_context *gc, char *str) { // Intercept Mesa's internal fatal-message mechanism @@ -199,7 +199,7 @@ D3DBLEND _gldConvertBlendFunc( //--------------------------------------------------------------------------- void gld_Noop_DX9( - GLcontext *ctx) + struct gl_context *ctx) { #ifdef _DEBUG gldLogMessage(GLDLOG_ERROR, "gld_Noop called!\n"); @@ -209,7 +209,7 @@ void gld_Noop_DX9( //--------------------------------------------------------------------------- void gld_Error_DX9( - GLcontext *ctx) + struct gl_context *ctx) { #ifdef _DEBUG // Quite useless. @@ -222,7 +222,7 @@ void gld_Error_DX9( //--------------------------------------------------------------------------- static GLboolean gld_set_draw_buffer_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLenum mode) { (void) ctx; @@ -237,8 +237,8 @@ static GLboolean gld_set_draw_buffer_DX9( //--------------------------------------------------------------------------- static void gld_set_read_buffer_DX9( - GLcontext *ctx, - GLframebuffer *buffer, + struct gl_context *ctx, + struct gl_framebuffer *buffer, GLenum mode) { /* separate read buffer not supported */ @@ -251,7 +251,7 @@ static void gld_set_read_buffer_DX9( //--------------------------------------------------------------------------- void gld_Clear_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLbitfield mask, GLboolean all, GLint x, @@ -340,8 +340,8 @@ void gld_Clear_DX9( // Mesa 5: Parameter change static void gld_buffer_size_DX9( -// GLcontext *ctx, - GLframebuffer *fb, +// struct gl_context *ctx, + struct gl_framebuffer *fb, GLuint *width, GLuint *height) { @@ -354,14 +354,14 @@ static void gld_buffer_size_DX9( //--------------------------------------------------------------------------- static void gld_Finish_DX9( - GLcontext *ctx) + struct gl_context *ctx) { } //--------------------------------------------------------------------------- static void gld_Flush_DX9( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gld = GLD_GET_CONTEXT(ctx); @@ -377,7 +377,7 @@ static void gld_Flush_DX9( //--------------------------------------------------------------------------- void gld_NEW_STENCIL( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); @@ -402,7 +402,7 @@ void gld_NEW_STENCIL( //--------------------------------------------------------------------------- void gld_NEW_COLOR( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); @@ -434,7 +434,7 @@ void gld_NEW_COLOR( //--------------------------------------------------------------------------- void gld_NEW_DEPTH( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); @@ -447,7 +447,7 @@ void gld_NEW_DEPTH( //--------------------------------------------------------------------------- void gld_NEW_POLYGON( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); @@ -513,7 +513,7 @@ void gld_NEW_POLYGON( //--------------------------------------------------------------------------- void gld_NEW_FOG( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); @@ -568,7 +568,7 @@ void gld_NEW_FOG( //--------------------------------------------------------------------------- void gld_NEW_LIGHT( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); @@ -588,7 +588,7 @@ void gld_NEW_LIGHT( //--------------------------------------------------------------------------- void gld_NEW_MODELVIEW( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); @@ -620,7 +620,7 @@ void gld_NEW_MODELVIEW( //--------------------------------------------------------------------------- void gld_NEW_PROJECTION( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); @@ -699,7 +699,7 @@ void gldOrthoHook_DX9( //--------------------------------------------------------------------------- void gld_NEW_VIEWPORT( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); @@ -741,7 +741,7 @@ void gld_NEW_VIEWPORT( //--------------------------------------------------------------------------- void gld_NEW_SCISSOR( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); @@ -768,7 +768,7 @@ void gld_NEW_SCISSOR( //--------------------------------------------------------------------------- __inline BOOL _gldAnyEvalEnabled( - GLcontext *ctx) + struct gl_context *ctx) { struct gl_eval_attrib *eval = &ctx->Eval; @@ -800,7 +800,7 @@ __inline BOOL _gldAnyEvalEnabled( //--------------------------------------------------------------------------- BOOL _gldChooseInternalPipeline( - GLcontext *ctx, + struct gl_context *ctx, GLD_driver_dx9 *gld) { // return TRUE; // DEBUGGING: ALWAYS USE MESA @@ -864,7 +864,7 @@ BOOL _gldChooseInternalPipeline( //--------------------------------------------------------------------------- void gld_update_state_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint new_state) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); @@ -1001,7 +1001,7 @@ void gld_update_state_DX9( //--------------------------------------------------------------------------- void gld_Viewport_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLint x, GLint y, GLsizei w, @@ -1063,12 +1063,12 @@ void gld_Viewport_DX9( //--------------------------------------------------------------------------- -extern BOOL dglWglResizeBuffers(GLcontext *ctx, BOOL bDefaultDriver); +extern BOOL dglWglResizeBuffers(struct gl_context *ctx, BOOL bDefaultDriver); // Mesa 5: Parameter change void gldResizeBuffers_DX9( -// GLcontext *ctx) - GLframebuffer *fb) +// struct gl_context *ctx) + struct gl_framebuffer *fb) { GET_CURRENT_CONTEXT(ctx); dglWglResizeBuffers(ctx, TRUE); @@ -1079,7 +1079,7 @@ void gldResizeBuffers_DX9( // This is only for debugging. // To use, plug into ctx->Driver.Enable pointer below. void gld_Enable( - GLcontext *ctx, + struct gl_context *ctx, GLenum e, GLboolean b) { @@ -1092,10 +1092,10 @@ void gld_Enable( // Driver pointer setup //--------------------------------------------------------------------------- -extern const GLubyte* _gldGetStringGeneric(GLcontext*, GLenum); +extern const GLubyte* _gldGetStringGeneric(struct gl_context*, GLenum); void gldSetupDriverPointers_DX9( - GLcontext *ctx) + struct gl_context *ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_dx9.h b/src/mesa/drivers/windows/gldirect/dx9/gld_dx9.h index aec40ac9dd..67601da7fb 100644 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_dx9.h +++ b/src/mesa/drivers/windows/gldirect/dx9/gld_dx9.h @@ -259,69 +259,69 @@ typedef struct { //--------------------------------------------------------------------------- PROC gldGetProcAddress_DX9(LPCSTR a); -void gldEnableExtensions_DX9(GLcontext *ctx); -void gldInstallPipeline_DX9(GLcontext *ctx); -void gldSetupDriverPointers_DX9(GLcontext *ctx); -//void gldResizeBuffers_DX9(GLcontext *ctx); -void gldResizeBuffers_DX9(GLframebuffer *fb); +void gldEnableExtensions_DX9(struct gl_context *ctx); +void gldInstallPipeline_DX9(struct gl_context *ctx); +void gldSetupDriverPointers_DX9(struct gl_context *ctx); +//void gldResizeBuffers_DX9(struct gl_context *ctx); +void gldResizeBuffers_DX9(struct gl_framebuffer *fb); // Texture functions -void gldCopyTexImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border); -void gldCopyTexImage2D_DX9(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -void gldCopyTexSubImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ); -void gldCopyTexSubImage2D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ); -void gldCopyTexSubImage3D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); - -void gld_NEW_TEXTURE_DX9(GLcontext *ctx); -void gld_DrawPixels_DX9(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels); -void gld_ReadPixels_DX9(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest); -void gld_CopyPixels_DX9(GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type); -void gld_Bitmap_DX9(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap); -const struct gl_texture_format* gld_ChooseTextureFormat_DX9(GLcontext *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType); -void gld_TexImage2D_DX9(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 *tObj, struct gl_texture_image *texImage); -void gld_TexImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, 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 ); -void gld_TexSubImage2D_DX9( 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 ); -void gld_TexSubImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); -void gld_DeleteTexture_DX9(GLcontext *ctx, struct gl_texture_object *tObj); -void gld_ResetLineStipple_DX9(GLcontext *ctx); +void gldCopyTexImage1D_DX9(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border); +void gldCopyTexImage2D_DX9(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +void gldCopyTexSubImage1D_DX9(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ); +void gldCopyTexSubImage2D_DX9(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ); +void gldCopyTexSubImage3D_DX9(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); + +void gld_NEW_TEXTURE_DX9(struct gl_context *ctx); +void gld_DrawPixels_DX9(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels); +void gld_ReadPixels_DX9(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest); +void gld_CopyPixels_DX9(struct gl_context *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type); +void gld_Bitmap_DX9(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap); +const struct gl_texture_format* gld_ChooseTextureFormat_DX9(struct gl_context *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType); +void gld_TexImage2D_DX9(struct gl_context *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 *tObj, struct gl_texture_image *texImage); +void gld_TexImage1D_DX9(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, 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 ); +void gld_TexSubImage2D_DX9( struct gl_context *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 ); +void gld_TexSubImage1D_DX9(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); +void gld_DeleteTexture_DX9(struct gl_context *ctx, struct gl_texture_object *tObj); +void gld_ResetLineStipple_DX9(struct gl_context *ctx); // 2D primitive functions -void gld_Points2D_DX9(GLcontext *ctx, GLuint first, GLuint last); +void gld_Points2D_DX9(struct gl_context *ctx, GLuint first, GLuint last); -void gld_Line2DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Line2DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1); +void gld_Line2DFlat_DX9(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Line2DSmooth_DX9(struct gl_context *ctx, GLuint v0, GLuint v1); -void gld_Triangle2DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DFlatExtras_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DSmoothExtras_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DFlat_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DSmooth_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DFlatExtras_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DSmoothExtras_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad2DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DFlatExtras_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DSmoothExtras_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DFlat_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DSmooth_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DFlatExtras_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DSmoothExtras_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); // 3D primitive functions -void gld_Points3D_DX9(GLcontext *ctx, GLuint first, GLuint last); -void gld_Line3DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Triangle3DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad3DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Line3DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Triangle3DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad3DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Points3D_DX9(struct gl_context *ctx, GLuint first, GLuint last); +void gld_Line3DFlat_DX9(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Triangle3DFlat_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Quad3DFlat_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Line3DSmooth_DX9(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Triangle3DSmooth_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Quad3DSmooth_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); // Primitive functions for Two-sided-lighting Vertex Shader -void gld_Points2DTwoside_DX9(GLcontext *ctx, GLuint first, GLuint last); -void gld_Line2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Line2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1); -void gld_Triangle2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Triangle2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2); -void gld_Quad2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void gld_Quad2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Points2DTwoside_DX9(struct gl_context *ctx, GLuint first, GLuint last); +void gld_Line2DFlatTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Line2DSmoothTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1); +void gld_Triangle2DFlatTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Triangle2DSmoothTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2); +void gld_Quad2DFlatTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +void gld_Quad2DSmoothTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3); #endif diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_ext_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_ext_dx9.c index e8c73a6ff8..667c59c491 100644 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_ext_dx9.c +++ b/src/mesa/drivers/windows/gldirect/dx9/gld_ext_dx9.c @@ -69,7 +69,7 @@ #include "extensions.h" // For some reason this is not defined in an above header... -extern void _mesa_enable_imaging_extensions(GLcontext *ctx); +extern void _mesa_enable_imaging_extensions(struct gl_context *ctx); //--------------------------------------------------------------------------- // Hack for the SGIS_multitexture extension that was removed from Mesa @@ -281,7 +281,7 @@ PROC gldGetProcAddress_DX( //--------------------------------------------------------------------------- void gldEnableExtensions_DX9( - GLcontext *ctx) + struct gl_context *ctx) { GLuint i; diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_pipeline_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_pipeline_dx9.c index 2b272aa628..f9abbdbdfe 100644 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_pipeline_dx9.c +++ b/src/mesa/drivers/windows/gldirect/dx9/gld_pipeline_dx9.c @@ -65,7 +65,7 @@ static const struct tnl_pipeline_stage *gld_pipeline[] = { //--------------------------------------------------------------------------- void gldInstallPipeline_DX9( - GLcontext *ctx) + struct gl_context *ctx) { // Remove any existing pipeline stages, // then install GLDirect pipeline stages. diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c index fd4dd4ed75..99edd26e9d 100644 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c +++ b/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c @@ -277,7 +277,7 @@ //--------------------------------------------------------------------------- __inline DWORD _gldComputeFog( - GLcontext *ctx, + struct gl_context *ctx, SWvertex *swv) { // Full fog calculation. @@ -300,7 +300,7 @@ __inline DWORD _gldComputeFog( //--------------------------------------------------------------------------- void gld_ResetLineStipple_DX9( - GLcontext *ctx) + struct gl_context *ctx) { // TODO: Fake stipple with a 32x32 texture. } @@ -310,7 +310,7 @@ void gld_ResetLineStipple_DX9( //--------------------------------------------------------------------------- void gld_Points2D_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint first, GLuint last) { @@ -357,7 +357,7 @@ void gld_Points2D_DX9( //--------------------------------------------------------------------------- void gld_Line2DFlat_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1) { @@ -390,7 +390,7 @@ void gld_Line2DFlat_DX9( //--------------------------------------------------------------------------- void gld_Line2DSmooth_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1) { @@ -421,7 +421,7 @@ void gld_Line2DSmooth_DX9( //--------------------------------------------------------------------------- void gld_Triangle2DFlat_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -460,7 +460,7 @@ void gld_Triangle2DFlat_DX9( //--------------------------------------------------------------------------- void gld_Triangle2DSmooth_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -499,7 +499,7 @@ void gld_Triangle2DSmooth_DX9( //--------------------------------------------------------------------------- void gld_Triangle2DFlatExtras_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -548,7 +548,7 @@ void gld_Triangle2DFlatExtras_DX9( //--------------------------------------------------------------------------- void gld_Triangle2DSmoothExtras_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -588,7 +588,7 @@ void gld_Triangle2DSmoothExtras_DX9( //--------------------------------------------------------------------------- void gld_Quad2DFlat_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -652,7 +652,7 @@ void gld_Quad2DFlat_DX9( //--------------------------------------------------------------------------- void gld_Quad2DSmooth_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -715,7 +715,7 @@ void gld_Quad2DSmooth_DX9( //--------------------------------------------------------------------------- void gld_Quad2DFlatExtras_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -792,7 +792,7 @@ void gld_Quad2DFlatExtras_DX9( //--------------------------------------------------------------------------- void gld_Quad2DSmoothExtras_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -859,7 +859,7 @@ void gld_Quad2DSmoothExtras_DX9( //--------------------------------------------------------------------------- void gld_Points3D_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint first, GLuint last) { @@ -911,7 +911,7 @@ void gld_Points3D_DX9( //--------------------------------------------------------------------------- void gld_Line3DFlat_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1) { @@ -937,7 +937,7 @@ void gld_Line3DFlat_DX9( //--------------------------------------------------------------------------- void gld_Line3DSmooth_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1) { @@ -964,7 +964,7 @@ void gld_Line3DSmooth_DX9( //--------------------------------------------------------------------------- void gld_Triangle3DFlat_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -997,7 +997,7 @@ void gld_Triangle3DFlat_DX9( //--------------------------------------------------------------------------- void gld_Triangle3DSmooth_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) @@ -1031,7 +1031,7 @@ void gld_Triangle3DSmooth_DX9( //--------------------------------------------------------------------------- void gld_Quad3DFlat_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -1083,7 +1083,7 @@ void gld_Quad3DFlat_DX9( //--------------------------------------------------------------------------- void gld_Quad3DSmooth_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, @@ -1137,34 +1137,34 @@ void gld_Quad3DSmooth_DX9( /* -void gld_Points2DTwoside_DX9(GLcontext *ctx, GLuint first, GLuint last) +void gld_Points2DTwoside_DX9(struct gl_context *ctx, GLuint first, GLuint last) { // NOTE: Two-sided lighting does not apply to Points } //--------------------------------------------------------------------------- -void gld_Line2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1) +void gld_Line2DFlatTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1) { // NOTE: Two-sided lighting does not apply to Lines } //--------------------------------------------------------------------------- -void gld_Line2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1) +void gld_Line2DSmoothTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1) { // NOTE: Two-sided lighting does not apply to Lines } //--------------------------------------------------------------------------- -void gld_Triangle2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2) +void gld_Triangle2DFlatTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) { } //--------------------------------------------------------------------------- -void gld_Triangle2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2) +void gld_Triangle2DSmoothTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); @@ -1229,7 +1229,7 @@ void gld_Triangle2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuin //--------------------------------------------------------------------------- -void gld_Quad2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) +void gld_Quad2DFlatTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); @@ -1336,7 +1336,7 @@ void gld_Quad2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, //--------------------------------------------------------------------------- -void gld_Quad2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) +void gld_Quad2DSmoothTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_texture_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_texture_dx9.c index 5a82235616..bd7a64f57f 100644 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_texture_dx9.c +++ b/src/mesa/drivers/windows/gldirect/dx9/gld_texture_dx9.c @@ -760,7 +760,7 @@ const struct gl_texture_format* _gldMesaFormatForD3DFormat( //--------------------------------------------------------------------------- void gldCopyTexImage1D_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, @@ -772,7 +772,7 @@ void gldCopyTexImage1D_DX9( //--------------------------------------------------------------------------- void gldCopyTexImage2D_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, @@ -788,7 +788,7 @@ void gldCopyTexImage2D_DX9( //--------------------------------------------------------------------------- void gldCopyTexSubImage1D_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ) { @@ -798,7 +798,7 @@ void gldCopyTexSubImage1D_DX9( //--------------------------------------------------------------------------- void gldCopyTexSubImage2D_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, @@ -814,7 +814,7 @@ void gldCopyTexSubImage2D_DX9( //--------------------------------------------------------------------------- void gldCopyTexSubImage3D_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, @@ -846,7 +846,7 @@ typedef struct { //--------------------------------------------------------------------------- HRESULT _gldDrawPixels( - GLcontext *ctx, + struct gl_context *ctx, BOOL bChromakey, // Alpha test for glBitmap() images GLint x, // GL x position GLint y, // GL y position (needs flipping) @@ -991,7 +991,7 @@ HRESULT _gldDrawPixels( //--------------------------------------------------------------------------- void gld_DrawPixels_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, @@ -1060,7 +1060,7 @@ void gld_DrawPixels_DX9( //--------------------------------------------------------------------------- void gld_ReadPixels_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *pack, @@ -1230,7 +1230,7 @@ gld_ReadPixels_DX9_return: //--------------------------------------------------------------------------- void gld_CopyPixels_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLint srcx, GLint srcy, GLsizei width, @@ -1329,7 +1329,7 @@ void gld_CopyPixels_DX9( //--------------------------------------------------------------------------- void gld_Bitmap_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLint x, GLint y, GLsizei width, @@ -1440,7 +1440,7 @@ void gld_Bitmap_DX9( //--------------------------------------------------------------------------- void _gldAllocateTexture( - GLcontext *ctx, + struct gl_context *ctx, struct gl_texture_object *tObj, struct gl_texture_image *texImage) { @@ -1486,7 +1486,7 @@ void _gldAllocateTexture( //--------------------------------------------------------------------------- const struct gl_texture_format* gld_ChooseTextureFormat_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType) @@ -1575,7 +1575,7 @@ const struct gl_texture_format* gld_ChooseTextureFormat_DX9( /* // Safer(?), slower version. void gld_TexImage2D_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, @@ -1653,7 +1653,7 @@ void gld_TexImage2D_DX9( // Faster, more efficient version. // Copies subimage straight to dest texture void gld_TexImage2D_DX9( - GLcontext *ctx, + struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, @@ -1727,7 +1727,7 @@ void gld_TexImage2D_DX9( //--------------------------------------------------------------------------- -void gld_TexImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, +void gld_TexImage1D_DX9(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, @@ -1742,7 +1742,7 @@ void gld_TexImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, //--------------------------------------------------------------------------- /* -void gld_TexSubImage2D( GLcontext *ctx, GLenum target, GLint level, +void gld_TexSubImage2D( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -1818,7 +1818,7 @@ void gld_TexSubImage2D( GLcontext *ctx, GLenum target, GLint level, // Faster, more efficient version. // Copies subimage straight to dest texture -void gld_TexSubImage2D_DX9( GLcontext *ctx, GLenum target, GLint level, +void gld_TexSubImage2D_DX9( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -1879,7 +1879,7 @@ void gld_TexSubImage2D_DX9( GLcontext *ctx, GLenum target, GLint level, //--------------------------------------------------------------------------- -void gld_TexSubImage1D_DX9( GLcontext *ctx, GLenum target, GLint level, +void gld_TexSubImage1D_DX9( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, @@ -1893,7 +1893,7 @@ void gld_TexSubImage1D_DX9( GLcontext *ctx, GLenum target, GLint level, //--------------------------------------------------------------------------- void gld_DeleteTexture_DX9( - GLcontext *ctx, + struct gl_context *ctx, struct gl_texture_object *tObj) { GLD_context *gld = (GLD_context*)(ctx->DriverCtx); @@ -1945,7 +1945,7 @@ __inline void _gldSetAlphaOps( //--------------------------------------------------------------------------- void gldUpdateTextureUnit( - GLcontext *ctx, + struct gl_context *ctx, GLuint unit, BOOL bPassThrough) { @@ -2050,7 +2050,7 @@ void gldUpdateTextureUnit( //--------------------------------------------------------------------------- void gld_NEW_TEXTURE_DX9( - GLcontext *ctx) + struct gl_context *ctx) { // TODO: Support for three (ATI Radeon) or more (nVidia GeForce3) texture units diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c index 91a68b3f2d..5f818d9f96 100644 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c +++ b/src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c @@ -61,7 +61,7 @@ //--------------------------------------------------------------------------- __inline void _gldSetVertexShaderConstants( - GLcontext *ctx, + struct gl_context *ctx, GLD_driver_dx9 *gld) { D3DXMATRIX mat, matView, matProj; @@ -116,7 +116,7 @@ __inline void _gldSetVertexShaderConstants( //--------------------------------------------------------------------------- static GLboolean gld_d3d_render_stage_run( - GLcontext *ctx, + struct gl_context *ctx, struct tnl_pipeline_stage *stage) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); @@ -237,7 +237,7 @@ static GLboolean gld_d3d_render_stage_run( //--------------------------------------------------------------------------- static void gld_d3d_render_stage_check( - GLcontext *ctx, + struct gl_context *ctx, struct tnl_pipeline_stage *stage) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_vb_mesa_render_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_vb_mesa_render_dx9.c index 64acab2d2a..b5e005b25b 100644 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_vb_mesa_render_dx9.c +++ b/src/mesa/drivers/windows/gldirect/dx9/gld_vb_mesa_render_dx9.c @@ -162,7 +162,7 @@ do { \ /* TODO: do this for all primitives, verts and elts: */ -static void clip_elt_triangles( GLcontext *ctx, +static void clip_elt_triangles( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -250,7 +250,7 @@ static void clip_elt_triangles( GLcontext *ctx, /* Helper functions for drivers */ /**********************************************************************/ /* -void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n ) +void _tnl_RenderClippedPolygon( struct gl_context *ctx, const GLuint *elts, GLuint n ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; @@ -261,7 +261,7 @@ void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n ) VB->Elts = tmp; } -void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) +void _tnl_RenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->Driver.Render.Line( ctx, ii, jj ); @@ -301,7 +301,7 @@ tnl_quad_func _gldSetupQuad[4] = { //--------------------------------------------------------------------------- static GLboolean _gld_mesa_render_stage_run( - GLcontext *ctx, + struct gl_context *ctx, struct tnl_pipeline_stage *stage) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_wgl_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_wgl_dx9.c index a03b865bb4..6cf46fb7a8 100644 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_wgl_dx9.c +++ b/src/mesa/drivers/windows/gldirect/dx9/gld_wgl_dx9.c @@ -54,8 +54,8 @@ extern int nContextError; #define DDLOG_CRITICAL_OR_WARN DDLOG_CRITICAL -extern void _gld_mesa_warning(GLcontext *, char *); -extern void _gld_mesa_fatal(GLcontext *, char *); +extern void _gld_mesa_warning(struct gl_context *, char *); +extern void _gld_mesa_fatal(struct gl_context *, char *); //--------------------------------------------------------------------------- @@ -246,7 +246,7 @@ void _gldDestroyPrimitiveBuffer( //--------------------------------------------------------------------------- HRESULT _gldCreatePrimitiveBuffer( - GLcontext *ctx, + struct gl_context *ctx, GLD_driver_dx9 *lpCtx, GLD_pb_dx9 *gldVB) { diff --git a/src/mesa/drivers/windows/gldirect/gld_driver.c b/src/mesa/drivers/windows/gldirect/gld_driver.c index f7c575614b..aa7bc27c99 100644 --- a/src/mesa/drivers/windows/gldirect/gld_driver.c +++ b/src/mesa/drivers/windows/gldirect/gld_driver.c @@ -193,7 +193,7 @@ static BOOL _GetDisplayMode_ERROR( //--------------------------------------------------------------------------- const GLubyte* _gldGetStringGeneric( - GLcontext *ctx, + struct gl_context *ctx, GLenum name) { if (!ctx) diff --git a/src/mesa/drivers/windows/gldirect/gld_driver.h b/src/mesa/drivers/windows/gldirect/gld_driver.h index 01a46a8325..7c393bc4c7 100644 --- a/src/mesa/drivers/windows/gldirect/gld_driver.h +++ b/src/mesa/drivers/windows/gldirect/gld_driver.h @@ -83,7 +83,7 @@ typedef struct { extern GLD_driver _gldDriver; BOOL gldInitDriverPointers(DWORD dwDriver); -const GLubyte* _gldGetStringGeneric(GLcontext *ctx, GLenum name); +const GLubyte* _gldGetStringGeneric(struct gl_context *ctx, GLenum name); #endif // _USE_GLD3_WGL diff --git a/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c b/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c index f927abfa11..7a26df8071 100644 --- a/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c +++ b/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c @@ -610,7 +610,7 @@ BOOL wmFlush(PWMC pwc, HDC hDC) // Support Functions //--------------------------------------------------------------------------- -static void flush(GLcontext* ctx) +static void flush(struct gl_context* ctx) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx); @@ -634,10 +634,10 @@ static void flush(GLcontext* ctx) /* * Set the color used to clear the color buffer. */ -//static void clear_color( GLcontext* ctx, const GLchan color[4] ) +//static void clear_color( struct gl_context* ctx, const GLchan color[4] ) // Changed for Mesa 5.x. KeithH static void clear_color( - GLcontext* ctx, + struct gl_context* ctx, const GLfloat color[4]) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); @@ -664,7 +664,7 @@ static void clear_color( * Otherwise, we let swrast do it. */ -static clear(GLcontext* ctx, GLbitfield mask, +static clear(struct gl_context* ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); @@ -787,7 +787,7 @@ static clear(GLcontext* ctx, GLbitfield mask, //--------------------------------------------------------------------------- -static void enable( GLcontext* ctx, GLenum pname, GLboolean enable ) +static void enable( struct gl_context* ctx, GLenum pname, GLboolean enable ) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx); @@ -814,7 +814,7 @@ static void enable( GLcontext* ctx, GLenum pname, GLboolean enable ) //--------------------------------------------------------------------------- -static GLboolean set_draw_buffer( GLcontext* ctx, GLenum mode ) +static GLboolean set_draw_buffer( struct gl_context* ctx, GLenum mode ) { /* TODO: this could be better */ if (mode==GL_FRONT_LEFT || mode==GL_BACK_LEFT) { @@ -828,7 +828,7 @@ static GLboolean set_draw_buffer( GLcontext* ctx, GLenum mode ) //--------------------------------------------------------------------------- -static void set_read_buffer(GLcontext *ctx, GLframebuffer *colorBuffer, +static void set_read_buffer(struct gl_context *ctx, struct gl_framebuffer *colorBuffer, GLenum buffer ) { /* XXX todo */ @@ -840,10 +840,10 @@ static void set_read_buffer(GLcontext *ctx, GLframebuffer *colorBuffer, /* Return characteristics of the output buffer. */ -//static void buffer_size( GLcontext* ctx, GLuint *width, GLuint *height ) +//static void buffer_size( struct gl_context* ctx, GLuint *width, GLuint *height ) // Altered for Mesa 5.x. KeithH static void buffer_size( - GLframebuffer *buffer, + struct gl_framebuffer *buffer, GLuint *width, GLuint *height) { @@ -888,28 +888,28 @@ static void buffer_size( /* Accelerated routines are not implemented in 4.0. See OSMesa for ideas. */ -static void fast_rgb_points( GLcontext* ctx, GLuint first, GLuint last ) +static void fast_rgb_points( struct gl_context* ctx, GLuint first, GLuint last ) { } //--------------------------------------------------------------------------- /* Return pointer to accelerated points function */ -extern tnl_points_func choose_points_function( GLcontext* ctx ) +extern tnl_points_func choose_points_function( struct gl_context* ctx ) { return NULL; } //--------------------------------------------------------------------------- -static void fast_flat_rgb_line( GLcontext* ctx, GLuint v0, +static void fast_flat_rgb_line( struct gl_context* ctx, GLuint v0, GLuint v1, GLuint pv ) { } //--------------------------------------------------------------------------- -static tnl_line_func choose_line_function( GLcontext* ctx ) +static tnl_line_func choose_line_function( struct gl_context* ctx ) { } @@ -920,7 +920,7 @@ static tnl_line_func choose_line_function( GLcontext* ctx ) /* Write a horizontal span of 32-bit color-index pixels with a boolean mask. */ -static void write_ci32_span( const GLcontext* ctx, +static void write_ci32_span( const struct gl_context* ctx, GLuint n, GLint x, GLint y, const GLuint index[], const GLubyte mask[] ) @@ -939,7 +939,7 @@ static void write_ci32_span( const GLcontext* ctx, //--------------------------------------------------------------------------- /* Write a horizontal span of 8-bit color-index pixels with a boolean mask. */ -static void write_ci8_span( const GLcontext* ctx, +static void write_ci8_span( const struct gl_context* ctx, GLuint n, GLint x, GLint y, const GLubyte index[], const GLubyte mask[] ) @@ -962,7 +962,7 @@ static void write_ci8_span( const GLcontext* ctx, * Write a horizontal span of pixels with a boolean mask. The current * color index is used for all pixels. */ -static void write_mono_ci_span(const GLcontext* ctx, +static void write_mono_ci_span(const struct gl_context* ctx, GLuint n,GLint x,GLint y, GLuint colorIndex, const GLubyte mask[]) { @@ -984,7 +984,7 @@ static void write_mono_ci_span(const GLcontext* ctx, */ /* Write a horizontal span of RGBA color pixels with a boolean mask. */ -static void write_rgba_span( const GLcontext* ctx, GLuint n, GLint x, GLint y, +static void write_rgba_span( const struct gl_context* ctx, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], const GLubyte mask[] ) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); @@ -1035,7 +1035,7 @@ static void write_rgba_span( const GLcontext* ctx, GLuint n, GLint x, GLint y, //--------------------------------------------------------------------------- /* Write a horizontal span of RGB color pixels with a boolean mask. */ -static void write_rgb_span( const GLcontext* ctx, +static void write_rgb_span( const struct gl_context* ctx, GLuint n, GLint x, GLint y, const GLubyte rgb[][3], const GLubyte mask[] ) { @@ -1090,7 +1090,7 @@ static void write_rgb_span( const GLcontext* ctx, * Write a horizontal span of pixels with a boolean mask. The current color * is used for all pixels. */ -static void write_mono_rgba_span( const GLcontext* ctx, +static void write_mono_rgba_span( const struct gl_context* ctx, GLuint n, GLint x, GLint y, const GLchan color[4], const GLubyte mask[]) { @@ -1123,7 +1123,7 @@ static void write_mono_rgba_span( const GLcontext* ctx, /* Write an array of 32-bit index pixels with a boolean mask. */ -static void write_ci32_pixels( const GLcontext* ctx, +static void write_ci32_pixels( const struct gl_context* ctx, GLuint n, const GLint x[], const GLint y[], const GLuint index[], const GLubyte mask[] ) { @@ -1147,7 +1147,7 @@ static void write_ci32_pixels( const GLcontext* ctx, * Write an array of pixels with a boolean mask. The current color * index is used for all pixels. */ -static void write_mono_ci_pixels( const GLcontext* ctx, +static void write_mono_ci_pixels( const struct gl_context* ctx, GLuint n, const GLint x[], const GLint y[], GLuint colorIndex, const GLubyte mask[] ) @@ -1169,7 +1169,7 @@ static void write_mono_ci_pixels( const GLcontext* ctx, /* Write an array of RGBA pixels with a boolean mask. */ -static void write_rgba_pixels( const GLcontext* ctx, +static void write_rgba_pixels( const struct gl_context* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], const GLubyte mask[] ) { @@ -1194,7 +1194,7 @@ static void write_rgba_pixels( const GLcontext* ctx, * Write an array of pixels with a boolean mask. The current color * is used for all pixels. */ -static void write_mono_rgba_pixels( const GLcontext* ctx, +static void write_mono_rgba_pixels( const struct gl_context* ctx, GLuint n, const GLint x[], const GLint y[], const GLchan color[4], @@ -1218,7 +1218,7 @@ static void write_mono_rgba_pixels( const GLcontext* ctx, /**********************************************************************/ /* Read a horizontal span of color-index pixels. */ -static void read_ci32_span( const GLcontext* ctx, GLuint n, GLint x, GLint y, +static void read_ci32_span( const struct gl_context* ctx, GLuint n, GLint x, GLint y, GLuint index[]) { GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); @@ -1233,7 +1233,7 @@ static void read_ci32_span( const GLcontext* ctx, GLuint n, GLint x, GLint y, //--------------------------------------------------------------------------- /* Read an array of color index pixels. */ -static void read_ci32_pixels( const GLcontext* ctx, +static void read_ci32_pixels( const struct gl_context* ctx, GLuint n, const GLint x[], const GLint y[], GLuint indx[], const GLubyte mask[] ) { @@ -1251,7 +1251,7 @@ static void read_ci32_pixels( const GLcontext* ctx, //--------------------------------------------------------------------------- /* Read a horizontal span of color pixels. */ -static void read_rgba_span( const GLcontext* ctx, +static void read_rgba_span( const struct gl_context* ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] ) { @@ -1275,7 +1275,7 @@ static void read_rgba_span( const GLcontext* ctx, //--------------------------------------------------------------------------- /* Read an array of color pixels. */ -static void read_rgba_pixels( const GLcontext* ctx, +static void read_rgba_pixels( const struct gl_context* ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] ) { @@ -1301,7 +1301,7 @@ static void read_rgba_pixels( const GLcontext* ctx, //--------------------------------------------------------------------------- static void wmesa_update_state( - GLcontext *ctx, + struct gl_context *ctx, GLuint new_state) { _swrast_InvalidateState( ctx, new_state ); @@ -1313,7 +1313,7 @@ static void wmesa_update_state( //--------------------------------------------------------------------------- static void wmesa_viewport( - GLcontext *ctx, + struct gl_context *ctx, GLint x, GLint y, GLsizei w, @@ -1325,7 +1325,7 @@ static void wmesa_viewport( //--------------------------------------------------------------------------- static void wmesa_update_state_first_time( - GLcontext *ctx, + struct gl_context *ctx, GLuint new_state) { struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx ); @@ -1570,7 +1570,7 @@ BOOL gldBuildPixelformatList_MesaSW(void) BOOL gldInitialiseMesa_MesaSW( DGL_ctx *gld) { - GLcontext *ctx; + struct gl_context *ctx; if (gld == NULL) return FALSE; diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index dac1668cfe..00ceb960c6 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -349,7 +349,7 @@ XMesaBuffer XMesaBufferList = NULL; /** * Allocate a new XMesaBuffer object which corresponds to the given drawable. - * Note that XMesaBuffer is derived from GLframebuffer. + * Note that XMesaBuffer is derived from struct gl_framebuffer. * The new XMesaBuffer will not have any size (Width=Height=0). * * \param d the corresponding X drawable (window or pixmap) @@ -1047,7 +1047,7 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b, XMesaColormap cmap) { int client = 0; - const int xclass = v->mesa_visual.visualType; + const int xclass = v->visualType; #ifdef XFree86Server client = (window) ? CLIENT_ID(window->id) : 0; @@ -1200,7 +1200,7 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b, * Convert an RGBA color to a pixel value. */ unsigned long -xmesa_color_to_pixel(GLcontext *ctx, +xmesa_color_to_pixel(struct gl_context *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLuint pixelFormat) { @@ -1397,20 +1397,20 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display, v->mesa_visual.redMask = visinfo->redMask; v->mesa_visual.greenMask = visinfo->greenMask; v->mesa_visual.blueMask = visinfo->blueMask; - v->mesa_visual.visualID = visinfo->vid; - v->mesa_visual.screen = 0; /* FIXME: What should be done here? */ + v->visualID = visinfo->vid; + v->screen = 0; /* FIXME: What should be done here? */ #else v->mesa_visual.redMask = visinfo->red_mask; v->mesa_visual.greenMask = visinfo->green_mask; v->mesa_visual.blueMask = visinfo->blue_mask; - v->mesa_visual.visualID = visinfo->visualid; - v->mesa_visual.screen = visinfo->screen; + v->visualID = visinfo->visualid; + v->screen = visinfo->screen; #endif #if defined(XFree86Server) || !(defined(__cplusplus) || defined(c_plusplus)) - v->mesa_visual.visualType = xmesa_convert_from_x_visual_type(visinfo->class); + v->visualType = xmesa_convert_from_x_visual_type(visinfo->class); #else - v->mesa_visual.visualType = xmesa_convert_from_x_visual_type(visinfo->c_class); + v->visualType = xmesa_convert_from_x_visual_type(visinfo->c_class); #endif v->mesa_visual.visualRating = visualCaveat; @@ -1421,7 +1421,7 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display, (void) initialize_visual_and_buffer( v, NULL, 0, 0 ); { - const int xclass = v->mesa_visual.visualType; + const int xclass = v->visualType; if (xclass == GLX_TRUE_COLOR || xclass == GLX_DIRECT_COLOR) { red_bits = _mesa_bitcount(GET_REDMASK(v)); green_bits = _mesa_bitcount(GET_GREENMASK(v)); @@ -1481,7 +1481,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) { static GLboolean firstTime = GL_TRUE; XMesaContext c; - GLcontext *mesaCtx; + struct gl_context *mesaCtx; struct dd_function_table functions; TNLcontext *tnl; @@ -1490,7 +1490,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) firstTime = GL_FALSE; } - /* Note: the XMesaContext contains a Mesa GLcontext struct (inheritance) */ + /* Note: the XMesaContext contains a Mesa struct gl_context struct (inheritance) */ c = (XMesaContext) CALLOC_STRUCT(xmesa_context); if (!c) return NULL; @@ -1501,7 +1501,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) _mesa_init_driver_functions(&functions); xmesa_init_driver_functions(v, &functions); if (!_mesa_initialize_context(mesaCtx, &v->mesa_visual, - share_list ? &(share_list->mesa) : (GLcontext *) NULL, + share_list ? &(share_list->mesa) : (struct gl_context *) NULL, &functions, (void *) c)) { free(c); return NULL; @@ -1574,7 +1574,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) PUBLIC void XMesaDestroyContext( XMesaContext c ) { - GLcontext *mesaCtx = &c->mesa; + struct gl_context *mesaCtx = &c->mesa; #ifdef FX FXdestroyContext( XMESA_BUFFER(mesaCtx->DrawBuffer) ); @@ -1788,7 +1788,7 @@ XMesaDestroyBuffer(XMesaBuffer b) /** - * Query the current window size and update the corresponding GLframebuffer + * Query the current window size and update the corresponding struct gl_framebuffer * and all attached renderbuffers. * Called when: * 1. the first time a buffer is bound to a context. @@ -1804,7 +1804,7 @@ xmesa_check_and_update_buffer_size(XMesaContext xmctx, XMesaBuffer drawBuffer) xmesa_get_window_size(drawBuffer->display, drawBuffer, &width, &height); if (drawBuffer->mesa_buffer.Width != width || drawBuffer->mesa_buffer.Height != height) { - GLcontext *ctx = xmctx ? &xmctx->mesa : NULL; + struct gl_context *ctx = xmctx ? &xmctx->mesa : NULL; _mesa_resize_framebuffer(ctx, &(drawBuffer->mesa_buffer), width, height); } drawBuffer->mesa_buffer.Initialized = GL_TRUE; /* XXX TEMPORARY? */ @@ -2252,7 +2252,7 @@ unsigned long XMesaDitherColor( XMesaContext xmesa, GLint x, GLint y, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) { - GLcontext *ctx = &xmesa->mesa; + struct gl_context *ctx = &xmesa->mesa; GLint r = (GLint) (red * 255.0F); GLint g = (GLint) (green * 255.0F); GLint b = (GLint) (blue * 255.0F); diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c index e47949750a..2683bd44d1 100644 --- a/src/mesa/drivers/x11/xm_buffer.c +++ b/src/mesa/drivers/x11/xm_buffer.c @@ -251,7 +251,7 @@ xmesa_delete_renderbuffer(struct gl_renderbuffer *rb) * Called via gl_renderbuffer::AllocStorage() */ static GLboolean -xmesa_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb, +xmesa_alloc_front_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb); @@ -278,7 +278,7 @@ xmesa_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb, * Called via gl_renderbuffer::AllocStorage() */ static GLboolean -xmesa_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb, +xmesa_alloc_back_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb); @@ -323,7 +323,7 @@ xmesa_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb, struct xmesa_renderbuffer * -xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual, +xmesa_new_renderbuffer(struct gl_context *ctx, GLuint name, const struct gl_config *visual, GLboolean backBuffer) { struct xmesa_renderbuffer *xrb = CALLOC_STRUCT(xmesa_renderbuffer); diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 5edafb890b..acece2025c 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -91,7 +91,7 @@ const int xmesa_kernel1[16] = { static void -finish_or_flush( GLcontext *ctx ) +finish_or_flush( struct gl_context *ctx ) { #ifdef XFree86Server /* NOT_NEEDED */ @@ -107,7 +107,7 @@ finish_or_flush( GLcontext *ctx ) static void -clear_color( GLcontext *ctx, const GLfloat color[4] ) +clear_color( struct gl_context *ctx, const GLfloat color[4] ) { if (ctx->DrawBuffer->Name == 0) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -134,12 +134,12 @@ clear_color( GLcontext *ctx, const GLfloat color[4] ) /* Implements glColorMask() */ static void -color_mask(GLcontext *ctx, +color_mask(struct gl_context *ctx, GLboolean rmask, GLboolean gmask, GLboolean bmask, GLboolean amask) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaBuffer xmbuf; - const int xclass = xmesa->xm_visual->mesa_visual.visualType; + const int xclass = xmesa->xm_visual->visualType; (void) amask; if (ctx->DrawBuffer->Name != 0) @@ -173,7 +173,7 @@ color_mask(GLcontext *ctx, * Clear the front or back color buffer, if it's implemented with a pixmap. */ static void -clear_pixmap(GLcontext *ctx, struct xmesa_renderbuffer *xrb, +clear_pixmap(struct gl_context *ctx, struct xmesa_renderbuffer *xrb, GLint x, GLint y, GLint width, GLint height) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -193,7 +193,7 @@ clear_pixmap(GLcontext *ctx, struct xmesa_renderbuffer *xrb, static void -clear_8bit_ximage( GLcontext *ctx, struct xmesa_renderbuffer *xrb, +clear_8bit_ximage( struct gl_context *ctx, struct xmesa_renderbuffer *xrb, GLint x, GLint y, GLint width, GLint height ) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -206,7 +206,7 @@ clear_8bit_ximage( GLcontext *ctx, struct xmesa_renderbuffer *xrb, static void -clear_HPCR_ximage( GLcontext *ctx, struct xmesa_renderbuffer *xrb, +clear_HPCR_ximage( struct gl_context *ctx, struct xmesa_renderbuffer *xrb, GLint x, GLint y, GLint width, GLint height ) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -227,7 +227,7 @@ clear_HPCR_ximage( GLcontext *ctx, struct xmesa_renderbuffer *xrb, static void -clear_16bit_ximage( GLcontext *ctx, struct xmesa_renderbuffer *xrb, +clear_16bit_ximage( struct gl_context *ctx, struct xmesa_renderbuffer *xrb, GLint x, GLint y, GLint width, GLint height) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -249,7 +249,7 @@ clear_16bit_ximage( GLcontext *ctx, struct xmesa_renderbuffer *xrb, /* Optimized code provided by Nozomi Ytow <noz@xfree86.org> */ static void -clear_24bit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb, +clear_24bit_ximage(struct gl_context *ctx, struct xmesa_renderbuffer *xrb, GLint x, GLint y, GLint width, GLint height) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -282,7 +282,7 @@ clear_24bit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb, static void -clear_32bit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb, +clear_32bit_ximage(struct gl_context *ctx, struct xmesa_renderbuffer *xrb, GLint x, GLint y, GLint width, GLint height) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -326,7 +326,7 @@ clear_32bit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb, static void -clear_nbit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb, +clear_nbit_ximage(struct gl_context *ctx, struct xmesa_renderbuffer *xrb, GLint x, GLint y, GLint width, GLint height) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -345,7 +345,7 @@ clear_nbit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb, static void -clear_buffers(GLcontext *ctx, GLbitfield buffers) +clear_buffers(struct gl_context *ctx, GLbitfield buffers) { if (ctx->DrawBuffer->Name == 0) { /* this is a window system framebuffer */ @@ -396,7 +396,7 @@ clear_buffers(GLcontext *ctx, GLbitfield buffers) * Check if we can do an optimized glDrawPixels into an 8R8G8B visual. */ static GLboolean -can_do_DrawPixels_8R8G8B(GLcontext *ctx, GLenum format, GLenum type) +can_do_DrawPixels_8R8G8B(struct gl_context *ctx, GLenum format, GLenum type) { if (format == GL_BGRA && type == GL_UNSIGNED_BYTE && @@ -432,7 +432,7 @@ can_do_DrawPixels_8R8G8B(GLcontext *ctx, GLenum format, GLenum type) * The image format must be GL_BGRA to match the PF_8R8G8B pixel format. */ static void -xmesa_DrawPixels_8R8G8B( GLcontext *ctx, +xmesa_DrawPixels_8R8G8B( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, @@ -529,7 +529,7 @@ xmesa_DrawPixels_8R8G8B( GLcontext *ctx, * Check if we can do an optimized glDrawPixels into an 5R6G5B visual. */ static GLboolean -can_do_DrawPixels_5R6G5B(GLcontext *ctx, GLenum format, GLenum type) +can_do_DrawPixels_5R6G5B(struct gl_context *ctx, GLenum format, GLenum type) { if (format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 && @@ -567,7 +567,7 @@ can_do_DrawPixels_5R6G5B(GLcontext *ctx, GLenum format, GLenum type) * match the PF_5R6G5B pixel format. */ static void -xmesa_DrawPixels_5R6G5B( GLcontext *ctx, +xmesa_DrawPixels_5R6G5B( struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, @@ -662,7 +662,7 @@ xmesa_DrawPixels_5R6G5B( GLcontext *ctx, * Determine if we can do an optimized glCopyPixels. */ static GLboolean -can_do_CopyPixels(GLcontext *ctx, GLenum type) +can_do_CopyPixels(struct gl_context *ctx, GLenum type) { if (type == GL_COLOR && ctx->_ImageTransferState == 0 && /* no color tables, scale/bias, etc */ @@ -701,7 +701,7 @@ can_do_CopyPixels(GLcontext *ctx, GLenum type) * We do support copying from one window to another, ala glXMakeCurrentRead. */ static void -xmesa_CopyPixels( GLcontext *ctx, +xmesa_CopyPixels( struct gl_context *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint destx, GLint desty, GLenum type ) { @@ -740,7 +740,7 @@ xmesa_CopyPixels( GLcontext *ctx, * return a meaningful GL_RENDERER string. */ static const GLubyte * -get_string( GLcontext *ctx, GLenum name ) +get_string( struct gl_context *ctx, GLenum name ) { (void) ctx; switch (name) { @@ -767,7 +767,7 @@ get_string( GLcontext *ctx, GLenum name ) * dither enable/disable. */ static void -enable( GLcontext *ctx, GLenum pname, GLboolean state ) +enable( struct gl_context *ctx, GLenum pname, GLboolean state ) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -785,7 +785,7 @@ enable( GLcontext *ctx, GLenum pname, GLboolean state ) static void -clear_color_HPCR_ximage( GLcontext *ctx, const GLfloat color[4] ) +clear_color_HPCR_ximage( struct gl_context *ctx, const GLfloat color[4] ) { int i; const XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -819,7 +819,7 @@ clear_color_HPCR_ximage( GLcontext *ctx, const GLfloat color[4] ) static void -clear_color_HPCR_pixmap( GLcontext *ctx, const GLfloat color[4] ) +clear_color_HPCR_pixmap( struct gl_context *ctx, const GLfloat color[4] ) { int i; const XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -863,7 +863,7 @@ clear_color_HPCR_pixmap( GLcontext *ctx, const GLfloat color[4] ) * flags. */ void -xmesa_update_state( GLcontext *ctx, GLbitfield new_state ) +xmesa_update_state( struct gl_context *ctx, GLbitfield new_state ) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -954,7 +954,7 @@ xmesa_update_state( GLcontext *ctx, GLbitfield new_state ) * texels. */ static GLboolean -test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level, +test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLenum format, GLenum type, GLint width, GLint height, GLint depth, GLint border) { @@ -988,7 +988,7 @@ test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level, * In SW, we don't really compress GL_COMPRESSED_RGB[A] textures! */ static gl_format -choose_tex_format( GLcontext *ctx, GLint internalFormat, +choose_tex_format( struct gl_context *ctx, GLint internalFormat, GLenum format, GLenum type ) { switch (internalFormat) { @@ -1014,7 +1014,7 @@ choose_tex_format( GLcontext *ctx, GLint internalFormat, * That problem led to the GLX_MESA_resize_buffers extension. */ static void -xmesa_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) +xmesa_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { XMesaContext xmctx = XMESA_CONTEXT(ctx); XMesaBuffer xmdrawbuf = XMESA_BUFFER(ctx->WinSysDrawBuffer); @@ -1044,7 +1044,7 @@ struct xmesa_query_object static struct gl_query_object * -xmesa_new_query_object(GLcontext *ctx, GLuint id) +xmesa_new_query_object(struct gl_context *ctx, GLuint id) { struct xmesa_query_object *q = CALLOC_STRUCT(xmesa_query_object); if (q) { @@ -1056,7 +1056,7 @@ xmesa_new_query_object(GLcontext *ctx, GLuint id) static void -xmesa_begin_query(GLcontext *ctx, struct gl_query_object *q) +xmesa_begin_query(struct gl_context *ctx, struct gl_query_object *q) { if (q->Target == GL_TIME_ELAPSED_EXT) { struct xmesa_query_object *xq = (struct xmesa_query_object *) q; @@ -1083,7 +1083,7 @@ time_diff(const struct timeval *t0, const struct timeval *t1) static void -xmesa_end_query(GLcontext *ctx, struct gl_query_object *q) +xmesa_end_query(struct gl_context *ctx, struct gl_query_object *q) { if (q->Target == GL_TIME_ELAPSED_EXT) { struct xmesa_query_object *xq = (struct xmesa_query_object *) q; @@ -1175,7 +1175,7 @@ xmesa_init_driver_functions( XMesaVisual xmvisual, * functions. * Called during context creation only. */ -void xmesa_register_swrast_functions( GLcontext *ctx ) +void xmesa_register_swrast_functions( struct gl_context *ctx ) { SWcontext *swrast = SWRAST_CONTEXT( ctx ); diff --git a/src/mesa/drivers/x11/xm_line.c b/src/mesa/drivers/x11/xm_line.c index f643b6d3a7..f03f99f918 100644 --- a/src/mesa/drivers/x11/xm_line.c +++ b/src/mesa/drivers/x11/xm_line.c @@ -54,7 +54,7 @@ */ #if 000 /* XXX don't use this, it doesn't dither correctly */ -static void draw_points_ANY_pixmap( GLcontext *ctx, const SWvertex *vert ) +static void draw_points_ANY_pixmap( struct gl_context *ctx, const SWvertex *vert ) { XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaDisplay *dpy = xmesa->xm_visual->display; @@ -89,7 +89,7 @@ static void draw_points_ANY_pixmap( GLcontext *ctx, const SWvertex *vert ) * our internal point functions, otherwise fall back to the standard * swrast functions. */ -void xmesa_choose_point( GLcontext *ctx ) +void xmesa_choose_point( struct gl_context *ctx ) { #if 0 XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -546,7 +546,7 @@ void xmesa_choose_point( GLcontext *ctx ) * for the XSetLineAttributes() function call. */ static void -xor_line(GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1) +xor_line(struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1) { XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaDisplay *dpy = xmesa->xm_visual->display; @@ -578,7 +578,7 @@ xor_line(GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1) * swrast fallback. */ static swrast_line_func -get_line_func(GLcontext *ctx) +get_line_func(struct gl_context *ctx) { #if CHAN_BITS == 8 SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -682,7 +682,7 @@ get_line_func(GLcontext *ctx) * standard swrast functions. */ void -xmesa_choose_line(GLcontext *ctx) +xmesa_choose_line(struct gl_context *ctx) { SWcontext *swrast = SWRAST_CONTEXT(ctx); diff --git a/src/mesa/drivers/x11/xm_span.c b/src/mesa/drivers/x11/xm_span.c index c39d87c451..ab66c5e1f1 100644 --- a/src/mesa/drivers/x11/xm_span.c +++ b/src/mesa/drivers/x11/xm_span.c @@ -163,13 +163,13 @@ static unsigned long read_pixel( XMesaDisplay *dpy, #define PUT_ROW_ARGS \ - GLcontext *ctx, \ + struct gl_context *ctx, \ struct gl_renderbuffer *rb, \ GLuint n, GLint x, GLint y, \ const void *values, const GLubyte mask[] #define RGB_SPAN_ARGS \ - GLcontext *ctx, \ + struct gl_context *ctx, \ struct gl_renderbuffer *rb, \ GLuint n, GLint x, GLint y, \ const void *values, const GLubyte mask[] @@ -2242,7 +2242,7 @@ static void put_row_rgb_GRAYSCALE8_ximage( RGB_SPAN_ARGS ) #define PUT_VALUES_ARGS \ - GLcontext *ctx, struct gl_renderbuffer *rb, \ + struct gl_context *ctx, struct gl_renderbuffer *rb, \ GLuint n, const GLint x[], const GLint y[], \ const void *values, const GLubyte mask[] @@ -2829,7 +2829,7 @@ static void put_values_GRAYSCALE8_ximage( PUT_VALUES_ARGS ) /**********************************************************************/ #define PUT_MONO_ROW_ARGS \ - GLcontext *ctx, struct gl_renderbuffer *rb, \ + struct gl_context *ctx, struct gl_renderbuffer *rb, \ GLuint n, GLint x, GLint y, const void *value, \ const GLubyte mask[] @@ -3267,7 +3267,7 @@ static void put_mono_row_DITHER_5R6G5B_ximage( PUT_MONO_ROW_ARGS ) /**********************************************************************/ #define PUT_MONO_VALUES_ARGS \ - GLcontext *ctx, struct gl_renderbuffer *rb, \ + struct gl_context *ctx, struct gl_renderbuffer *rb, \ GLuint n, const GLint x[], const GLint y[], \ const void *value, const GLubyte mask[] @@ -3773,7 +3773,7 @@ static void put_values_ci_ximage( PUT_VALUES_ARGS ) * else return number of pixels to skip in the destination array. */ static int -clip_for_xgetimage(GLcontext *ctx, XMesaPixmap pixmap, GLuint *n, GLint *x, GLint *y) +clip_for_xgetimage(struct gl_context *ctx, XMesaPixmap pixmap, GLuint *n, GLint *x, GLint *y) { XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaBuffer source = XMESA_BUFFER(ctx->DrawBuffer); @@ -3813,7 +3813,7 @@ clip_for_xgetimage(GLcontext *ctx, XMesaPixmap pixmap, GLuint *n, GLint *x, GLin * Read a horizontal span of color-index pixels. */ static void -get_row_ci(GLcontext *ctx, struct gl_renderbuffer *rb, +get_row_ci(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, void *values) { GLuint *index = (GLuint *) values; @@ -3870,7 +3870,7 @@ get_row_ci(GLcontext *ctx, struct gl_renderbuffer *rb, * Read a horizontal span of color pixels. */ static void -get_row_rgba(GLcontext *ctx, struct gl_renderbuffer *rb, +get_row_rgba(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, void *values) { GLubyte (*rgba)[4] = (GLubyte (*)[4]) values; @@ -4272,7 +4272,7 @@ get_row_rgba(GLcontext *ctx, struct gl_renderbuffer *rb, * Read an array of color index pixels. */ static void -get_values_ci(GLcontext *ctx, struct gl_renderbuffer *rb, +get_values_ci(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], void *values) { GLuint *indx = (GLuint *) values; @@ -4296,7 +4296,7 @@ get_values_ci(GLcontext *ctx, struct gl_renderbuffer *rb, static void -get_values_rgba(GLcontext *ctx, struct gl_renderbuffer *rb, +get_values_rgba(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], void *values) { GLubyte (*rgba)[4] = (GLubyte (*)[4]) values; diff --git a/src/mesa/drivers/x11/xm_tri.c b/src/mesa/drivers/x11/xm_tri.c index a6efb35e3c..98dece113d 100644 --- a/src/mesa/drivers/x11/xm_tri.c +++ b/src/mesa/drivers/x11/xm_tri.c @@ -1448,7 +1448,7 @@ do { \ * swrast fallback. */ static swrast_tri_func -get_triangle_func(GLcontext *ctx) +get_triangle_func(struct gl_context *ctx) { #if CHAN_BITS == 8 SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -1644,7 +1644,7 @@ get_triangle_func(GLcontext *ctx) * of our internal tri functions, otherwise fall back to the * standard swrast functions. */ -void xmesa_choose_triangle( GLcontext *ctx ) +void xmesa_choose_triangle( struct gl_context *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index e0a6908228..5d34b430cb 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -54,7 +54,7 @@ struct xmesa_renderbuffer; /* Function pointer for clearing color buffers */ -typedef void (*ClearFunc)( GLcontext *ctx, struct xmesa_renderbuffer *xrb, +typedef void (*ClearFunc)( struct gl_context *ctx, struct xmesa_renderbuffer *xrb, GLint x, GLint y, GLint width, GLint height ); @@ -80,12 +80,14 @@ enum pixel_format { /** - * Visual inforation, derived from GLvisual. + * Visual inforation, derived from struct gl_config. * Basically corresponds to an XVisualInfo. */ struct xmesa_visual { - GLvisual mesa_visual; /* Device independent visual parameters */ + struct gl_config mesa_visual; /* Device independent visual parameters */ XMesaDisplay *display; /* The X11 display */ + int screen, visualID; + int visualType; #ifdef XFree86Server GLint ColormapEntries; GLint nplanes; @@ -127,11 +129,11 @@ struct xmesa_visual { /** - * Context info, derived from GLcontext. + * Context info, derived from struct gl_context. * Basically corresponds to a GLXContext. */ struct xmesa_context { - GLcontext mesa; /* the core library context (containment) */ + struct gl_context mesa; /* the core library context (containment) */ XMesaVisual xm_visual; /* Describes the buffers */ XMesaBuffer xm_buffer; /* current span/point/line/triangle buffer */ @@ -204,7 +206,7 @@ struct xmesa_renderbuffer * Basically corresponds to a GLXDrawable. */ struct xmesa_buffer { - GLframebuffer mesa_buffer; /* depth, stencil, accum, etc buffers */ + struct gl_framebuffer mesa_buffer; /* depth, stencil, accum, etc buffers */ /* This MUST BE FIRST! */ GLboolean wasCurrent; /* was ever the current buffer? */ XMesaVisual xm_visual; /* the X/Mesa visual */ @@ -494,7 +496,7 @@ extern const int xmesa_kernel1[16]; */ extern struct xmesa_renderbuffer * -xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual, +xmesa_new_renderbuffer(struct gl_context *ctx, GLuint name, const struct gl_config *visual, GLboolean backBuffer); extern void @@ -504,7 +506,7 @@ extern XMesaBuffer xmesa_find_buffer(XMesaDisplay *dpy, XMesaColormap cmap, XMesaBuffer notThis); extern unsigned long -xmesa_color_to_pixel( GLcontext *ctx, +xmesa_color_to_pixel( struct gl_context *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLuint pixelFormat ); @@ -520,7 +522,7 @@ xmesa_init_driver_functions( XMesaVisual xmvisual, struct dd_function_table *driver ); extern void -xmesa_update_state( GLcontext *ctx, GLbitfield new_state ); +xmesa_update_state( struct gl_context *ctx, GLbitfield new_state ); extern void xmesa_set_renderbuffer_funcs(struct xmesa_renderbuffer *xrb, @@ -541,22 +543,22 @@ xmesa_renderbuffer(struct gl_renderbuffer *rb) /** - * Return pointer to XMesaContext corresponding to a Mesa GLcontext. + * Return pointer to XMesaContext corresponding to a Mesa struct gl_context. * Since we're using structure containment, it's just a cast!. */ static INLINE XMesaContext -XMESA_CONTEXT(GLcontext *ctx) +XMESA_CONTEXT(struct gl_context *ctx) { return (XMesaContext) ctx; } /** - * Return pointer to XMesaBuffer corresponding to a Mesa GLframebuffer. + * Return pointer to XMesaBuffer corresponding to a Mesa struct gl_framebuffer. * Since we're using structure containment, it's just a cast!. */ static INLINE XMesaBuffer -XMESA_BUFFER(GLframebuffer *b) +XMESA_BUFFER(struct gl_framebuffer *b) { return (XMesaBuffer) b; } @@ -565,12 +567,12 @@ XMESA_BUFFER(GLframebuffer *b) /* Plugged into the software rasterizer. Try to use internal * swrast-style point, line and triangle functions. */ -extern void xmesa_choose_point( GLcontext *ctx ); -extern void xmesa_choose_line( GLcontext *ctx ); -extern void xmesa_choose_triangle( GLcontext *ctx ); +extern void xmesa_choose_point( struct gl_context *ctx ); +extern void xmesa_choose_line( struct gl_context *ctx ); +extern void xmesa_choose_triangle( struct gl_context *ctx ); -extern void xmesa_register_swrast_functions( GLcontext *ctx ); +extern void xmesa_register_swrast_functions( struct gl_context *ctx ); diff --git a/src/mesa/drivers/x11/xmesa_x.h b/src/mesa/drivers/x11/xmesa_x.h index 865bab4313..ea6cb3f24e 100644 --- a/src/mesa/drivers/x11/xmesa_x.h +++ b/src/mesa/drivers/x11/xmesa_x.h @@ -79,7 +79,7 @@ typedef XColor XMesaColor; #define GET_GREENMASK(__v) __v->mesa_visual.greenMask #define GET_BLUEMASK(__v) __v->mesa_visual.blueMask #define GET_VISUAL_DEPTH(__v) __v->visinfo->depth -#define GET_BLACK_PIXEL(__v) BlackPixel(__v->display, __v->mesa_visual.screen) +#define GET_BLACK_PIXEL(__v) BlackPixel(__v->display, __v->screen) #define CHECK_BYTE_ORDER(__v) host_byte_order()==ImageByteOrder(__v->display) #define CHECK_FOR_HPCR(__v) XInternAtom(__v->display, "_HP_RGB_SMOOTH_MAP_LIST", True) |