Lines Matching refs:osmesa
134 (DST)[osmesa->rInd] = R; \
135 (DST)[osmesa->gInd] = G; \
136 (DST)[osmesa->bInd] = B; \
137 (DST)[osmesa->aInd] = A; \
140 #define PIXELADDR4(X,Y) ((GLchan *) osmesa->rowaddr[Y] + 4 * (X))
149 const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); \
170 const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); \
194 const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); in osmesa_choose_line_function() local
204 if (osmesa->format != OSMESA_RGBA && in osmesa_choose_line_function()
205 osmesa->format != OSMESA_BGRA && in osmesa_choose_line_function()
206 osmesa->format != OSMESA_ARGB) return NULL; in osmesa_choose_line_function()
237 const OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
267 const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); \
295 const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); in osmesa_choose_triangle_function() local
302 if (osmesa->format != OSMESA_RGBA && in osmesa_choose_triangle_function()
303 osmesa->format != OSMESA_BGRA && in osmesa_choose_triangle_function()
304 osmesa->format != OSMESA_ARGB) return (swrast_tri_func) NULL; in osmesa_choose_triangle_function()
355 compute_row_addresses( OSMesaContext osmesa ) in compute_row_addresses() argument
358 GLubyte *origin = (GLubyte *) osmesa->srb->Buffer; in compute_row_addresses()
360 GLint height = osmesa->srb->Base.Height; in compute_row_addresses()
362 if (osmesa->userRowLength) in compute_row_addresses()
363 rowlength = osmesa->userRowLength; in compute_row_addresses()
365 rowlength = osmesa->srb->Base.Width; in compute_row_addresses()
367 bytesPerRow = rowlength * _mesa_get_format_bytes(osmesa->srb->Base.Format); in compute_row_addresses()
369 if (osmesa->yup) { in compute_row_addresses()
372 osmesa->rowaddr[i] = (GLvoid *) ((GLubyte *) origin + i * bytesPerRow); in compute_row_addresses()
379 osmesa->rowaddr[i] = (GLvoid *) ((GLubyte *) origin + j * bytesPerRow); in compute_row_addresses()
405 const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); in osmesa_renderbuffer_storage() local
417 if (osmesa->format == OSMESA_RGBA) { in osmesa_renderbuffer_storage()
418 if (osmesa->DataType == GL_UNSIGNED_BYTE) { in osmesa_renderbuffer_storage()
424 else if (osmesa->DataType == GL_UNSIGNED_SHORT) { in osmesa_renderbuffer_storage()
431 else if (osmesa->format == OSMESA_BGRA) { in osmesa_renderbuffer_storage()
432 if (osmesa->DataType == GL_UNSIGNED_BYTE) { in osmesa_renderbuffer_storage()
438 else if (osmesa->DataType == GL_UNSIGNED_SHORT) { in osmesa_renderbuffer_storage()
447 else if (osmesa->format == OSMESA_ARGB) { in osmesa_renderbuffer_storage()
448 if (osmesa->DataType == GL_UNSIGNED_BYTE) { in osmesa_renderbuffer_storage()
454 else if (osmesa->DataType == GL_UNSIGNED_SHORT) { in osmesa_renderbuffer_storage()
463 else if (osmesa->format == OSMESA_RGB) { in osmesa_renderbuffer_storage()
464 if (osmesa->DataType == GL_UNSIGNED_BYTE) { in osmesa_renderbuffer_storage()
467 else if (osmesa->DataType == GL_UNSIGNED_SHORT) { in osmesa_renderbuffer_storage()
476 else if (osmesa->format == OSMESA_BGR) { in osmesa_renderbuffer_storage()
477 if (osmesa->DataType == GL_UNSIGNED_BYTE) { in osmesa_renderbuffer_storage()
480 else if (osmesa->DataType == GL_UNSIGNED_SHORT) { in osmesa_renderbuffer_storage()
489 else if (osmesa->format == OSMESA_RGB_565) { in osmesa_renderbuffer_storage()
490 ASSERT(osmesa->DataType == GL_UNSIGNED_BYTE); in osmesa_renderbuffer_storage()
500 compute_row_addresses( osmesa ); in osmesa_renderbuffer_storage()
540 const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); in osmesa_MapRenderbuffer() local
548 if (osmesa->userRowLength) in osmesa_MapRenderbuffer()
549 rowStride = osmesa->userRowLength * bpp; in osmesa_MapRenderbuffer()
553 if (!osmesa->yup) { in osmesa_MapRenderbuffer()
615 OSMesaContext osmesa; in OSMesaCreateContextExt() local
684 osmesa = (OSMesaContext) CALLOC_STRUCT(osmesa_context); in OSMesaCreateContextExt()
685 if (osmesa) { in OSMesaCreateContextExt()
686 osmesa->gl_visual = _mesa_create_visual( GL_FALSE, /* double buffer */ in OSMesaCreateContextExt()
700 if (!osmesa->gl_visual) { in OSMesaCreateContextExt()
701 free(osmesa); in OSMesaCreateContextExt()
712 if (!_mesa_initialize_context(&osmesa->mesa, in OSMesaCreateContextExt()
714 osmesa->gl_visual, in OSMesaCreateContextExt()
717 &functions, (void *) osmesa)) { in OSMesaCreateContextExt()
718 _mesa_destroy_visual( osmesa->gl_visual ); in OSMesaCreateContextExt()
719 free(osmesa); in OSMesaCreateContextExt()
723 _mesa_enable_sw_extensions(&(osmesa->mesa)); in OSMesaCreateContextExt()
724 _mesa_enable_1_3_extensions(&(osmesa->mesa)); in OSMesaCreateContextExt()
725 _mesa_enable_1_4_extensions(&(osmesa->mesa)); in OSMesaCreateContextExt()
726 _mesa_enable_1_5_extensions(&(osmesa->mesa)); in OSMesaCreateContextExt()
727 _mesa_enable_2_0_extensions(&(osmesa->mesa)); in OSMesaCreateContextExt()
728 _mesa_enable_2_1_extensions(&(osmesa->mesa)); in OSMesaCreateContextExt()
730 osmesa->gl_buffer = _mesa_create_framebuffer(osmesa->gl_visual); in OSMesaCreateContextExt()
731 if (!osmesa->gl_buffer) { in OSMesaCreateContextExt()
732 _mesa_destroy_visual( osmesa->gl_visual ); in OSMesaCreateContextExt()
733 _mesa_free_context_data( &osmesa->mesa ); in OSMesaCreateContextExt()
734 free(osmesa); in OSMesaCreateContextExt()
741 _swrast_add_soft_renderbuffers(osmesa->gl_buffer, in OSMesaCreateContextExt()
743 osmesa->gl_visual->haveDepthBuffer, in OSMesaCreateContextExt()
744 osmesa->gl_visual->haveStencilBuffer, in OSMesaCreateContextExt()
745 osmesa->gl_visual->haveAccumBuffer, in OSMesaCreateContextExt()
749 osmesa->format = format; in OSMesaCreateContextExt()
750 osmesa->userRowLength = 0; in OSMesaCreateContextExt()
751 osmesa->yup = GL_TRUE; in OSMesaCreateContextExt()
752 osmesa->rInd = rind; in OSMesaCreateContextExt()
753 osmesa->gInd = gind; in OSMesaCreateContextExt()
754 osmesa->bInd = bind; in OSMesaCreateContextExt()
755 osmesa->aInd = aind; in OSMesaCreateContextExt()
757 _mesa_meta_init(&osmesa->mesa); in OSMesaCreateContextExt()
761 struct gl_context *ctx = &osmesa->mesa; in OSMesaCreateContextExt()
769 _mesa_destroy_visual(osmesa->gl_visual); in OSMesaCreateContextExt()
771 free(osmesa); in OSMesaCreateContextExt()
794 return osmesa; in OSMesaCreateContextExt()
804 OSMesaDestroyContext( OSMesaContext osmesa ) in OSMesaDestroyContext() argument
806 if (osmesa) { in OSMesaDestroyContext()
807 if (osmesa->srb) in OSMesaDestroyContext()
808 _mesa_reference_renderbuffer((struct gl_renderbuffer **) &osmesa->srb, NULL); in OSMesaDestroyContext()
810 _mesa_meta_free( &osmesa->mesa ); in OSMesaDestroyContext()
812 _swsetup_DestroyContext( &osmesa->mesa ); in OSMesaDestroyContext()
813 _tnl_DestroyContext( &osmesa->mesa ); in OSMesaDestroyContext()
814 _vbo_DestroyContext( &osmesa->mesa ); in OSMesaDestroyContext()
815 _swrast_DestroyContext( &osmesa->mesa ); in OSMesaDestroyContext()
817 _mesa_destroy_visual( osmesa->gl_visual ); in OSMesaDestroyContext()
818 _mesa_reference_framebuffer( &osmesa->gl_buffer, NULL ); in OSMesaDestroyContext()
820 _mesa_free_context_data( &osmesa->mesa ); in OSMesaDestroyContext()
821 free( osmesa ); in OSMesaDestroyContext()
853 OSMesaMakeCurrent( OSMesaContext osmesa, void *buffer, GLenum type, in OSMesaMakeCurrent() argument
856 if (!osmesa || !buffer || in OSMesaMakeCurrent()
862 if (osmesa->format == OSMESA_RGB_565 && type != GL_UNSIGNED_SHORT_5_6_5) { in OSMesaMakeCurrent()
875 osmesa_update_state( &osmesa->mesa, 0 ); in OSMesaMakeCurrent()
891 if (!osmesa->srb) { in OSMesaMakeCurrent()
892 osmesa->srb = new_osmesa_renderbuffer(&osmesa->mesa, osmesa->format, type); in OSMesaMakeCurrent()
893 _mesa_remove_renderbuffer(osmesa->gl_buffer, BUFFER_FRONT_LEFT); in OSMesaMakeCurrent()
894 _mesa_add_renderbuffer(osmesa->gl_buffer, BUFFER_FRONT_LEFT, in OSMesaMakeCurrent()
895 &osmesa->srb->Base); in OSMesaMakeCurrent()
896 assert(osmesa->srb->Base.RefCount == 2); in OSMesaMakeCurrent()
899 osmesa->DataType = type; in OSMesaMakeCurrent()
904 osmesa->srb->Buffer = buffer; in OSMesaMakeCurrent()
905 osmesa->srb->Base.Width = osmesa->srb->Base.Height = 0; in OSMesaMakeCurrent()
910 _mesa_resize_framebuffer(&osmesa->mesa, osmesa->gl_buffer, width, height); in OSMesaMakeCurrent()
911 osmesa->gl_buffer->Initialized = GL_TRUE; /* XXX TEMPORARY? */ in OSMesaMakeCurrent()
913 _mesa_make_current( &osmesa->mesa, osmesa->gl_buffer, osmesa->gl_buffer ); in OSMesaMakeCurrent()
918 _mesa_remove_renderbuffer(osmesa->gl_buffer, BUFFER_FRONT_LEFT); in OSMesaMakeCurrent()
919 _mesa_add_renderbuffer(osmesa->gl_buffer, BUFFER_FRONT_LEFT, in OSMesaMakeCurrent()
920 &osmesa->srb->Base); in OSMesaMakeCurrent()
924 _mesa_update_framebuffer_visual(&osmesa->mesa, osmesa->gl_buffer); in OSMesaMakeCurrent()
927 _mesa_resize_framebuffer(&osmesa->mesa, osmesa->gl_buffer, width, height); in OSMesaMakeCurrent()
949 OSMesaContext osmesa = OSMesaGetCurrentContext(); in OSMesaPixelStore() local
954 _mesa_error( &osmesa->mesa, GL_INVALID_VALUE, in OSMesaPixelStore()
958 osmesa->userRowLength = value; in OSMesaPixelStore()
961 osmesa->yup = value ? GL_TRUE : GL_FALSE; in OSMesaPixelStore()
964 _mesa_error( &osmesa->mesa, GL_INVALID_ENUM, "OSMesaPixelStore(pname)" ); in OSMesaPixelStore()
968 compute_row_addresses( osmesa ); in OSMesaPixelStore()
975 OSMesaContext osmesa = OSMesaGetCurrentContext(); in OSMesaGetIntegerv() local
979 if (osmesa->gl_buffer) in OSMesaGetIntegerv()
980 *value = osmesa->gl_buffer->Width; in OSMesaGetIntegerv()
985 if (osmesa->gl_buffer) in OSMesaGetIntegerv()
986 *value = osmesa->gl_buffer->Height; in OSMesaGetIntegerv()
991 *value = osmesa->format; in OSMesaGetIntegerv()
995 *value = osmesa->DataType; in OSMesaGetIntegerv()
998 *value = osmesa->userRowLength; in OSMesaGetIntegerv()
1001 *value = osmesa->yup; in OSMesaGetIntegerv()
1010 _mesa_error(&osmesa->mesa, GL_INVALID_ENUM, "OSMesaGetIntergerv(pname)"); in OSMesaGetIntegerv()
1063 OSMesaGetColorBuffer( OSMesaContext osmesa, GLint *width, in OSMesaGetColorBuffer() argument
1066 if (osmesa->srb && osmesa->srb->Buffer) { in OSMesaGetColorBuffer()
1067 *width = osmesa->srb->Base.Width; in OSMesaGetColorBuffer()
1068 *height = osmesa->srb->Base.Height; in OSMesaGetColorBuffer()
1069 *format = osmesa->format; in OSMesaGetColorBuffer()
1070 *buffer = (void *) osmesa->srb->Buffer; in OSMesaGetColorBuffer()
1120 OSMesaContext osmesa = OSMesaGetCurrentContext(); in OSMesaColorClamp() local
1123 osmesa->mesa.Color.ClampFragmentColor = GL_TRUE; in OSMesaColorClamp()
1126 osmesa->mesa.Color.ClampFragmentColor = GL_FIXED_ONLY_ARB; in OSMesaColorClamp()