Lines Matching defs:osmesa

54 #include "GL/osmesa.h"
194 osmesa_read_buffer(OSMesaContext osmesa, struct pipe_resource *res, void *dst,
197 struct pipe_context *pipe = osmesa->stctx->pipe;
363 OSMesaContext osmesa = OSMesaGetCurrentContext();
372 if (osmesa->pp) {
391 pp_run(osmesa->pp, res, res, zsbuf);
396 if (osmesa->user_row_length)
397 dst_stride = bpp * osmesa->user_row_length;
401 osmesa_read_buffer(osmesa, res, osbuffer->map, dst_stride, osmesa->y_up);
404 if (osmesa->zs) {
405 osmesa_read_buffer(osmesa, osbuffer->textures[ST_ATTACHMENT_DEPTH_STENCIL],
406 osmesa->zs, osmesa->zs_stride, true);
586 OSMesaContext osmesa;
661 osmesa = (OSMesaContext) CALLOC_STRUCT(osmesa_context);
662 if (!osmesa)
667 osmesa->accum_format = PIPE_FORMAT_R16G16B16A16_SNORM;
670 osmesa->depth_stencil_format = PIPE_FORMAT_Z24_UNORM_S8_UINT;
673 osmesa->depth_stencil_format = PIPE_FORMAT_S8_UINT;
676 osmesa->depth_stencil_format = PIPE_FORMAT_Z24X8_UNORM;
679 osmesa->depth_stencil_format = PIPE_FORMAT_Z16_UNORM;
698 osmesa->depth_stencil_format,
699 osmesa->accum_format);
701 osmesa->stctx = stapi->create_context(stapi, get_st_manager(),
703 if (!osmesa->stctx) {
704 FREE(osmesa);
708 osmesa->stctx->st_manager_private = osmesa;
710 osmesa->format = format;
711 osmesa->user_row_length = 0;
712 osmesa->y_up = GL_TRUE;
714 return osmesa;
722 * \param osmesa the context to destroy
725 OSMesaDestroyContext(OSMesaContext osmesa)
727 if (osmesa) {
728 pp_free(osmesa->pp);
729 osmesa->stctx->destroy(osmesa->stctx);
730 free(osmesa->zs);
731 FREE(osmesa);
749 * Input: osmesa - the rendering context
755 * Return: GL_TRUE if success, GL_FALSE if error because of invalid osmesa,
759 OSMesaMakeCurrent(OSMesaContext osmesa, void *buffer, GLenum type,
765 if (!osmesa && !buffer) {
770 if (!osmesa || !buffer || width < 1 || height < 1) {
774 color_format = osmesa_choose_format(osmesa->format, type);
781 if (osmesa->current_buffer &&
782 (osmesa->current_buffer->visual.color_format != color_format ||
783 osmesa->current_buffer->visual.depth_stencil_format != osmesa->depth_stencil_format ||
784 osmesa->current_buffer->visual.accum_format != osmesa->accum_format ||
785 osmesa->current_buffer->width != width ||
786 osmesa->current_buffer->height != height)) {
787 osmesa_destroy_buffer(osmesa->current_buffer);
788 osmesa->current_buffer = NULL;
791 if (!osmesa->current_buffer) {
792 osmesa->current_buffer = osmesa_create_buffer(color_format,
793 osmesa->depth_stencil_format,
794 osmesa->accum_format);
797 struct osmesa_buffer *osbuffer = osmesa->current_buffer;
803 osmesa->type = type;
805 stapi->make_current(stapi, osmesa->stctx, osbuffer->stfb, osbuffer->stfb);
812 if (!osmesa->ever_used) {
817 for (i = 0; i < ARRAY_SIZE(osmesa->pp_enabled); i++) {
818 if (osmesa->pp_enabled[i]) {
825 osmesa->pp = pp_init(osmesa->stctx->pipe,
826 osmesa->pp_enabled,
827 osmesa->stctx->cso_context,
828 osmesa->stctx);
830 pp_init_fbos(osmesa->pp, width, height);
833 osmesa->ever_used = TRUE;
854 OSMesaContext osmesa = OSMesaGetCurrentContext();
858 osmesa->user_row_length = value;
861 osmesa->y_up = value ? GL_TRUE : GL_FALSE;
873 OSMesaContext osmesa = OSMesaGetCurrentContext();
874 struct osmesa_buffer *osbuffer = osmesa ? osmesa->current_buffer : NULL;
884 *value = osmesa->format;
888 *value = osmesa->type;
891 *value = osmesa->user_row_length;
894 *value = osmesa->y_up;
962 OSMesaGetColorBuffer(OSMesaContext osmesa, GLint *width,
965 struct osmesa_buffer *osbuffer = osmesa->current_buffer;
970 *format = osmesa->format;
1031 OSMesaPostprocess(OSMesaContext osmesa, const char *filter,
1034 if (!osmesa->ever_used) {
1042 osmesa->pp_enabled[i] = enable_value;