osmesa_context.h 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //========================================================================
  2. // GLFW 3.4 OSMesa - www.glfw.org
  3. //------------------------------------------------------------------------
  4. // Copyright (c) 2016 Google Inc.
  5. // Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
  6. //
  7. // This software is provided 'as-is', without any express or implied
  8. // warranty. In no event will the authors be held liable for any damages
  9. // arising from the use of this software.
  10. //
  11. // Permission is granted to anyone to use this software for any purpose,
  12. // including commercial applications, and to alter it and redistribute it
  13. // freely, subject to the following restrictions:
  14. //
  15. // 1. The origin of this software must not be misrepresented; you must not
  16. // claim that you wrote the original software. If you use this software
  17. // in a product, an acknowledgment in the product documentation would
  18. // be appreciated but is not required.
  19. //
  20. // 2. Altered source versions must be plainly marked as such, and must not
  21. // be misrepresented as being the original software.
  22. //
  23. // 3. This notice may not be removed or altered from any source
  24. // distribution.
  25. //
  26. //========================================================================
  27. #define OSMESA_RGBA 0x1908
  28. #define OSMESA_FORMAT 0x22
  29. #define OSMESA_DEPTH_BITS 0x30
  30. #define OSMESA_STENCIL_BITS 0x31
  31. #define OSMESA_ACCUM_BITS 0x32
  32. #define OSMESA_PROFILE 0x33
  33. #define OSMESA_CORE_PROFILE 0x34
  34. #define OSMESA_COMPAT_PROFILE 0x35
  35. #define OSMESA_CONTEXT_MAJOR_VERSION 0x36
  36. #define OSMESA_CONTEXT_MINOR_VERSION 0x37
  37. typedef void* OSMesaContext;
  38. typedef void (*OSMESAproc)(void);
  39. typedef OSMesaContext (GLAPIENTRY * PFN_OSMesaCreateContextExt)(GLenum,GLint,GLint,GLint,OSMesaContext);
  40. typedef OSMesaContext (GLAPIENTRY * PFN_OSMesaCreateContextAttribs)(const int*,OSMesaContext);
  41. typedef void (GLAPIENTRY * PFN_OSMesaDestroyContext)(OSMesaContext);
  42. typedef int (GLAPIENTRY * PFN_OSMesaMakeCurrent)(OSMesaContext,void*,int,int,int);
  43. typedef int (GLAPIENTRY * PFN_OSMesaGetColorBuffer)(OSMesaContext,int*,int*,int*,void**);
  44. typedef int (GLAPIENTRY * PFN_OSMesaGetDepthBuffer)(OSMesaContext,int*,int*,int*,void**);
  45. typedef GLFWglproc (GLAPIENTRY * PFN_OSMesaGetProcAddress)(const char*);
  46. #define OSMesaCreateContextExt _glfw.osmesa.CreateContextExt
  47. #define OSMesaCreateContextAttribs _glfw.osmesa.CreateContextAttribs
  48. #define OSMesaDestroyContext _glfw.osmesa.DestroyContext
  49. #define OSMesaMakeCurrent _glfw.osmesa.MakeCurrent
  50. #define OSMesaGetColorBuffer _glfw.osmesa.GetColorBuffer
  51. #define OSMesaGetDepthBuffer _glfw.osmesa.GetDepthBuffer
  52. #define OSMesaGetProcAddress _glfw.osmesa.GetProcAddress
  53. // OSMesa-specific per-context data
  54. //
  55. typedef struct _GLFWcontextOSMesa
  56. {
  57. OSMesaContext handle;
  58. int width;
  59. int height;
  60. void* buffer;
  61. } _GLFWcontextOSMesa;
  62. // OSMesa-specific global data
  63. //
  64. typedef struct _GLFWlibraryOSMesa
  65. {
  66. void* handle;
  67. PFN_OSMesaCreateContextExt CreateContextExt;
  68. PFN_OSMesaCreateContextAttribs CreateContextAttribs;
  69. PFN_OSMesaDestroyContext DestroyContext;
  70. PFN_OSMesaMakeCurrent MakeCurrent;
  71. PFN_OSMesaGetColorBuffer GetColorBuffer;
  72. PFN_OSMesaGetDepthBuffer GetDepthBuffer;
  73. PFN_OSMesaGetProcAddress GetProcAddress;
  74. } _GLFWlibraryOSMesa;
  75. bool _glfwInitOSMesa(void);
  76. void _glfwTerminateOSMesa(void);
  77. bool _glfwCreateContextOSMesa(_GLFWwindow* window,
  78. const _GLFWctxconfig* ctxconfig,
  79. const _GLFWfbconfig* fbconfig);