Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * Mesa 3-D graphics library
  3.  *
  4.  * Copyright (C) 2009  VMware, Inc.  All Rights Reserved.
  5.  *
  6.  * Permission is hereby granted, free of charge, to any person obtaining a
  7.  * copy of this software and associated documentation files (the "Software"),
  8.  * to deal in the Software without restriction, including without limitation
  9.  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  10.  * and/or sell copies of the Software, and to permit persons to whom the
  11.  * Software is furnished to do so, subject to the following conditions:
  12.  *
  13.  * The above copyright notice and this permission notice shall be included
  14.  * in all copies or substantial portions of the Software.
  15.  *
  16.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  17.  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18.  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
  19.  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  20.  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  21.  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  22.  * OTHER DEALINGS IN THE SOFTWARE.
  23.  */
  24.  
  25.  
  26. #ifndef META_H
  27. #define META_H
  28.  
  29. #include "main/mtypes.h"
  30.  
  31. /**
  32.  * \name Flags for meta operations
  33.  * \{
  34.  *
  35.  * These flags are passed to _mesa_meta_begin().
  36.  */
  37. #define MESA_META_ALL                      ~0x0
  38. #define MESA_META_ALPHA_TEST                0x1
  39. #define MESA_META_BLEND                     0x2  /**< includes logicop */
  40. #define MESA_META_COLOR_MASK                0x4
  41. #define MESA_META_DEPTH_TEST                0x8
  42. #define MESA_META_FOG                      0x10
  43. #define MESA_META_PIXEL_STORE              0x20
  44. #define MESA_META_PIXEL_TRANSFER           0x40
  45. #define MESA_META_RASTERIZATION            0x80
  46. #define MESA_META_SCISSOR                 0x100
  47. #define MESA_META_SHADER                  0x200
  48. #define MESA_META_STENCIL_TEST            0x400
  49. #define MESA_META_TRANSFORM               0x800 /**< modelview/projection matrix state */
  50. #define MESA_META_TEXTURE                0x1000
  51. #define MESA_META_VERTEX                 0x2000
  52. #define MESA_META_VIEWPORT               0x4000
  53. #define MESA_META_CLAMP_FRAGMENT_COLOR   0x8000
  54. #define MESA_META_CLAMP_VERTEX_COLOR    0x10000
  55. #define MESA_META_CONDITIONAL_RENDER    0x20000
  56. #define MESA_META_CLIP                  0x40000
  57. #define MESA_META_SELECT_FEEDBACK       0x80000
  58. #define MESA_META_MULTISAMPLE          0x100000
  59. #define MESA_META_FRAMEBUFFER_SRGB     0x200000
  60. #define MESA_META_OCCLUSION_QUERY      0x400000
  61. #define MESA_META_DRAW_BUFFERS         0x800000
  62. #define MESA_META_DITHER              0x1000000
  63. /**\}*/
  64.  
  65. /**
  66.  * State which we may save/restore across meta ops.
  67.  * XXX this may be incomplete...
  68.  */
  69. struct save_state
  70. {
  71.    GLbitfield SavedState;  /**< bitmask of MESA_META_* flags */
  72.  
  73.    /* Always saved/restored with meta. */
  74.    gl_api API;
  75.  
  76.    /** MESA_META_CLEAR (and others?) */
  77.    struct gl_query_object *CurrentOcclusionObject;
  78.  
  79.    /** MESA_META_ALPHA_TEST */
  80.    GLboolean AlphaEnabled;
  81.    GLenum AlphaFunc;
  82.    GLclampf AlphaRef;
  83.  
  84.    /** MESA_META_BLEND */
  85.    GLbitfield BlendEnabled;
  86.    GLboolean ColorLogicOpEnabled;
  87.  
  88.    /** MESA_META_DITHER */
  89.    GLboolean DitherFlag;
  90.  
  91.    /** MESA_META_COLOR_MASK */
  92.    GLubyte ColorMask[MAX_DRAW_BUFFERS][4];
  93.  
  94.    /** MESA_META_DEPTH_TEST */
  95.    struct gl_depthbuffer_attrib Depth;
  96.  
  97.    /** MESA_META_FOG */
  98.    GLboolean Fog;
  99.  
  100.    /** MESA_META_PIXEL_STORE */
  101.    struct gl_pixelstore_attrib Pack, Unpack;
  102.  
  103.    /** MESA_META_PIXEL_TRANSFER */
  104.    GLfloat RedBias, RedScale;
  105.    GLfloat GreenBias, GreenScale;
  106.    GLfloat BlueBias, BlueScale;
  107.    GLfloat AlphaBias, AlphaScale;
  108.    GLfloat DepthBias, DepthScale;
  109.    GLboolean MapColorFlag;
  110.  
  111.    /** MESA_META_RASTERIZATION */
  112.    GLenum FrontPolygonMode, BackPolygonMode;
  113.    GLboolean PolygonOffset;
  114.    GLboolean PolygonSmooth;
  115.    GLboolean PolygonStipple;
  116.    GLboolean PolygonCull;
  117.  
  118.    /** MESA_META_SCISSOR */
  119.    struct gl_scissor_attrib Scissor;
  120.  
  121.    /** MESA_META_SHADER */
  122.    GLboolean VertexProgramEnabled;
  123.    struct gl_vertex_program *VertexProgram;
  124.    GLboolean FragmentProgramEnabled;
  125.    struct gl_fragment_program *FragmentProgram;
  126.    GLboolean ATIFragmentShaderEnabled;
  127.    struct gl_shader_program *Shader[MESA_SHADER_STAGES];
  128.    struct gl_shader_program *ActiveShader;
  129.    struct gl_pipeline_object   *Pipeline;
  130.  
  131.    /** MESA_META_STENCIL_TEST */
  132.    struct gl_stencil_attrib Stencil;
  133.  
  134.    /** MESA_META_TRANSFORM */
  135.    GLenum MatrixMode;
  136.    GLfloat ModelviewMatrix[16];
  137.    GLfloat ProjectionMatrix[16];
  138.    GLfloat TextureMatrix[16];
  139.    /** GL_ARB_clip_control */
  140.    GLenum ClipOrigin;     /**< GL_LOWER_LEFT or GL_UPPER_LEFT */
  141.    GLenum ClipDepthMode;  /**< GL_NEGATIVE_ONE_TO_ONE or GL_ZERO_TO_ONE */
  142.  
  143.    /** MESA_META_CLIP */
  144.    GLbitfield ClipPlanesEnabled;
  145.  
  146.    /** MESA_META_TEXTURE */
  147.    GLuint ActiveUnit;
  148.    GLuint ClientActiveUnit;
  149.    /** for unit[0] only */
  150.    struct gl_texture_object *CurrentTexture[NUM_TEXTURE_TARGETS];
  151.    /** mask of TEXTURE_2D_BIT, etc */
  152.    GLbitfield TexEnabled[MAX_TEXTURE_UNITS];
  153.    GLbitfield TexGenEnabled[MAX_TEXTURE_UNITS];
  154.    GLuint EnvMode;  /* unit[0] only */
  155.  
  156.    /** MESA_META_VERTEX */
  157.    struct gl_vertex_array_object *VAO;
  158.    struct gl_buffer_object *ArrayBufferObj;
  159.  
  160.    /** MESA_META_VIEWPORT */
  161.    GLfloat ViewportX, ViewportY, ViewportW, ViewportH;
  162.    GLclampd DepthNear, DepthFar;
  163.  
  164.    /** MESA_META_CLAMP_FRAGMENT_COLOR */
  165.    GLenum ClampFragmentColor;
  166.  
  167.    /** MESA_META_CLAMP_VERTEX_COLOR */
  168.    GLenum ClampVertexColor;
  169.  
  170.    /** MESA_META_CONDITIONAL_RENDER */
  171.    struct gl_query_object *CondRenderQuery;
  172.    GLenum CondRenderMode;
  173.  
  174.    /** MESA_META_SELECT_FEEDBACK */
  175.    GLenum RenderMode;
  176.    struct gl_selection Select;
  177.    struct gl_feedback Feedback;
  178.  
  179.    /** MESA_META_MULTISAMPLE */
  180.    struct gl_multisample_attrib Multisample;
  181.  
  182.    /** MESA_META_FRAMEBUFFER_SRGB */
  183.    GLboolean sRGBEnabled;
  184.  
  185.    /** Miscellaneous (always disabled) */
  186.    GLboolean Lighting;
  187.    GLboolean RasterDiscard;
  188.    GLboolean TransformFeedbackNeedsResume;
  189.  
  190.    GLuint DrawBufferName, ReadBufferName, RenderbufferName;
  191.  
  192.    /** MESA_META_DRAW_BUFFERS */
  193.    GLenum ColorDrawBuffers[MAX_DRAW_BUFFERS];
  194. };
  195.  
  196. /**
  197.  * Temporary texture used for glBlitFramebuffer, glDrawPixels, etc.
  198.  * This is currently shared by all the meta ops.  But we could create a
  199.  * separate one for each of glDrawPixel, glBlitFramebuffer, glCopyPixels, etc.
  200.  */
  201. struct temp_texture
  202. {
  203.    GLuint TexObj;
  204.    GLenum Target;         /**< GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE */
  205.    GLsizei MinSize;       /**< Min texture size to allocate */
  206.    GLsizei MaxSize;       /**< Max possible texture size */
  207.    GLboolean NPOT;        /**< Non-power of two size OK? */
  208.    GLsizei Width, Height; /**< Current texture size */
  209.    GLenum IntFormat;
  210.    GLfloat Sright, Ttop;  /**< right, top texcoords */
  211. };
  212.  
  213. /**
  214.  * State for GLSL texture sampler which is used to generate fragment
  215.  * shader in _mesa_meta_generate_mipmap().
  216.  */
  217. struct blit_shader {
  218.    const char *type;
  219.    const char *func;
  220.    const char *texcoords;
  221.    GLuint shader_prog;
  222. };
  223.  
  224. /**
  225.  * Table of all sampler types and shaders for accessing them.
  226.  */
  227. struct blit_shader_table {
  228.    struct blit_shader sampler_1d;
  229.    struct blit_shader sampler_2d;
  230.    struct blit_shader sampler_3d;
  231.    struct blit_shader sampler_rect;
  232.    struct blit_shader sampler_cubemap;
  233.    struct blit_shader sampler_1d_array;
  234.    struct blit_shader sampler_2d_array;
  235.    struct blit_shader sampler_cubemap_array;
  236. };
  237.  
  238. /**
  239.  * Indices in the blit_state->msaa_shaders[] array
  240.  *
  241.  * Note that setup_glsl_msaa_blit_shader() assumes that the _INT enums are five
  242.  * more than the corresponding non-_INT versions and _UINT are five beyond that.
  243.  */
  244. enum blit_msaa_shader {
  245.    BLIT_1X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE,
  246.    BLIT_2X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE,
  247.    BLIT_4X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE,
  248.    BLIT_8X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE,
  249.    BLIT_16X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE,
  250.    BLIT_1X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_INT,
  251.    BLIT_2X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_INT,
  252.    BLIT_4X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_INT,
  253.    BLIT_8X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_INT,
  254.    BLIT_16X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_INT,
  255.    BLIT_1X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_UINT,
  256.    BLIT_2X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_UINT,
  257.    BLIT_4X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_UINT,
  258.    BLIT_8X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_UINT,
  259.    BLIT_16X_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_UINT,
  260.    BLIT_MSAA_SHADER_2D_MULTISAMPLE_COPY,
  261.    BLIT_MSAA_SHADER_2D_MULTISAMPLE_COPY_INT,
  262.    BLIT_MSAA_SHADER_2D_MULTISAMPLE_COPY_UINT,
  263.    BLIT_MSAA_SHADER_2D_MULTISAMPLE_DEPTH_RESOLVE,
  264.    BLIT_MSAA_SHADER_2D_MULTISAMPLE_DEPTH_COPY,
  265.    BLIT_1X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE,
  266.    BLIT_2X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE,
  267.    BLIT_4X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE,
  268.    BLIT_8X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE,
  269.    BLIT_16X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE,
  270.    BLIT_1X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_INT,
  271.    BLIT_2X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_INT,
  272.    BLIT_4X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_INT,
  273.    BLIT_8X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_INT,
  274.    BLIT_16X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_INT,
  275.    BLIT_1X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_UINT,
  276.    BLIT_2X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_UINT,
  277.    BLIT_4X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_UINT,
  278.    BLIT_8X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_UINT,
  279.    BLIT_16X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_RESOLVE_UINT,
  280.    BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_COPY,
  281.    BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_COPY_INT,
  282.    BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_COPY_UINT,
  283.    BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_DEPTH_RESOLVE,
  284.    BLIT_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_DEPTH_COPY,
  285.    BLIT_2X_MSAA_SHADER_2D_MULTISAMPLE_SCALED_RESOLVE,
  286.    BLIT_4X_MSAA_SHADER_2D_MULTISAMPLE_SCALED_RESOLVE,
  287.    BLIT_8X_MSAA_SHADER_2D_MULTISAMPLE_SCALED_RESOLVE,
  288.    BLIT_2X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_SCALED_RESOLVE,
  289.    BLIT_4X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_SCALED_RESOLVE,
  290.    BLIT_8X_MSAA_SHADER_2D_MULTISAMPLE_ARRAY_SCALED_RESOLVE,
  291.    BLIT_MSAA_SHADER_COUNT,
  292. };
  293.  
  294. /**
  295.  * State for glBlitFramebufer()
  296.  */
  297. struct blit_state
  298. {
  299.    GLuint VAO;
  300.    GLuint VBO;
  301.    struct blit_shader_table shaders_with_depth;
  302.    struct blit_shader_table shaders_without_depth;
  303.    GLuint msaa_shaders[BLIT_MSAA_SHADER_COUNT];
  304.    struct temp_texture depthTex;
  305.    bool no_ctsi_fallback;
  306. };
  307.  
  308. struct fb_tex_blit_state
  309. {
  310.    GLint baseLevelSave, maxLevelSave;
  311.    GLuint sampler, samplerSave, stencilSamplingSave;
  312.    GLuint tempTex;
  313. };
  314.  
  315.  
  316. /**
  317.  * State for glClear()
  318.  */
  319. struct clear_state
  320. {
  321.    GLuint VAO;
  322.    GLuint VBO;
  323.    GLuint ShaderProg;
  324.    GLint ColorLocation;
  325.    GLint LayerLocation;
  326.  
  327.    GLuint IntegerShaderProg;
  328.    GLint IntegerColorLocation;
  329.    GLint IntegerLayerLocation;
  330. };
  331.  
  332.  
  333. /**
  334.  * State for glCopyPixels()
  335.  */
  336. struct copypix_state
  337. {
  338.    GLuint VAO;
  339.    GLuint VBO;
  340. };
  341.  
  342.  
  343. /**
  344.  * State for glDrawPixels()
  345.  */
  346. struct drawpix_state
  347. {
  348.    GLuint VAO;
  349.    GLuint VBO;
  350.  
  351.    GLuint StencilFP;  /**< Fragment program for drawing stencil images */
  352.    GLuint DepthFP;  /**< Fragment program for drawing depth images */
  353. };
  354.  
  355.  
  356. /**
  357.  * State for glBitmap()
  358.  */
  359. struct bitmap_state
  360. {
  361.    GLuint VAO;
  362.    GLuint VBO;
  363.    struct temp_texture Tex;  /**< separate texture from other meta ops */
  364. };
  365.  
  366. /**
  367.  * State for _mesa_meta_generate_mipmap()
  368.  */
  369. struct gen_mipmap_state
  370. {
  371.    GLuint VAO;
  372.    GLuint VBO;
  373.    GLuint FBO;
  374.    GLuint Sampler;
  375.  
  376.    struct blit_shader_table shaders;
  377. };
  378.  
  379. /**
  380.  * One of the FBO states for decompress_state. There will be one for each
  381.  * required renderbuffer format.
  382.  */
  383. struct decompress_fbo_state
  384. {
  385.    GLuint FBO, RBO;
  386.    GLint Width, Height;
  387. };
  388.  
  389. /**
  390.  * State for texture decompression
  391.  */
  392. struct decompress_state
  393. {
  394.    GLuint VAO;
  395.    struct decompress_fbo_state byteFBO, floatFBO;
  396.    GLuint VBO, Sampler;
  397.  
  398.    struct blit_shader_table shaders;
  399. };
  400.  
  401. /**
  402.  * State for glDrawTex()
  403.  */
  404. struct drawtex_state
  405. {
  406.    GLuint VAO;
  407.    GLuint VBO;
  408. };
  409.  
  410. #define MAX_META_OPS_DEPTH      8
  411. /**
  412.  * All per-context meta state.
  413.  */
  414. struct gl_meta_state
  415. {
  416.    /** Stack of state saved during meta-ops */
  417.    struct save_state Save[MAX_META_OPS_DEPTH];
  418.    /** Save stack depth */
  419.    GLuint SaveStackDepth;
  420.  
  421.    struct temp_texture TempTex;
  422.  
  423.    struct blit_state Blit;    /**< For _mesa_meta_BlitFramebuffer() */
  424.    struct clear_state Clear;  /**< For _mesa_meta_Clear() */
  425.    struct copypix_state CopyPix;  /**< For _mesa_meta_CopyPixels() */
  426.    struct drawpix_state DrawPix;  /**< For _mesa_meta_DrawPixels() */
  427.    struct bitmap_state Bitmap;    /**< For _mesa_meta_Bitmap() */
  428.    struct gen_mipmap_state Mipmap;    /**< For _mesa_meta_GenerateMipmap() */
  429.    struct decompress_state Decompress;  /**< For texture decompression */
  430.    struct drawtex_state DrawTex;  /**< For _mesa_meta_DrawTex() */
  431. };
  432.  
  433. struct vertex {
  434.    GLfloat x, y, z, tex[4];
  435.    GLfloat r, g, b, a;
  436. };
  437.  
  438. extern void
  439. _mesa_meta_init(struct gl_context *ctx);
  440.  
  441. extern void
  442. _mesa_meta_free(struct gl_context *ctx);
  443.  
  444. extern void
  445. _mesa_meta_begin(struct gl_context *ctx, GLbitfield state);
  446.  
  447. extern void
  448. _mesa_meta_end(struct gl_context *ctx);
  449.  
  450. static inline bool
  451. _mesa_meta_in_progress(struct gl_context *ctx)
  452. {
  453.    return ctx->Meta->SaveStackDepth != 0;
  454. }
  455.  
  456. extern void
  457. _mesa_meta_fb_tex_blit_begin(const struct gl_context *ctx,
  458.                              struct fb_tex_blit_state *blit);
  459.  
  460. extern void
  461. _mesa_meta_fb_tex_blit_end(struct gl_context *ctx, GLenum target,
  462.                            struct fb_tex_blit_state *blit);
  463.  
  464. extern GLboolean
  465. _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx,
  466.                                 struct gl_renderbuffer *rb,
  467.                                 GLuint *tex,
  468.                                 struct gl_texture_object **texObj,
  469.                                 GLenum *target);
  470.  
  471. GLuint
  472. _mesa_meta_setup_sampler(struct gl_context *ctx,
  473.                          const struct gl_texture_object *texObj,
  474.                          GLenum target, GLenum filter, GLuint srcLevel);
  475.  
  476. extern GLbitfield
  477. _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
  478.                            const struct gl_framebuffer *readFb,
  479.                            const struct gl_framebuffer *drawFb,
  480.                            GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
  481.                            GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
  482.                            GLbitfield mask, GLenum filter);
  483.  
  484. extern void
  485. _mesa_meta_and_swrast_BlitFramebuffer(struct gl_context *ctx,
  486.                                       struct gl_framebuffer *readFb,
  487.                                       struct gl_framebuffer *drawFb,
  488.                                       GLint srcX0, GLint srcY0,
  489.                                       GLint srcX1, GLint srcY1,
  490.                                       GLint dstX0, GLint dstY0,
  491.                                       GLint dstX1, GLint dstY1,
  492.                                       GLbitfield mask, GLenum filter);
  493.  
  494. bool
  495. _mesa_meta_CopyImageSubData_uncompressed(struct gl_context *ctx,
  496.                                          struct gl_texture_image *src_tex_image,
  497.                                          int src_x, int src_y, int src_z,
  498.                                          struct gl_texture_image *dst_tex_image,
  499.                                          int dst_x, int dst_y, int dst_z,
  500.                                          int src_width, int src_height);
  501.  
  502. extern void
  503. _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers);
  504.  
  505. extern void
  506. _mesa_meta_glsl_Clear(struct gl_context *ctx, GLbitfield buffers);
  507.  
  508. extern void
  509. _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
  510.                       GLsizei width, GLsizei height,
  511.                       GLint dstx, GLint dsty, GLenum type);
  512.  
  513. extern void
  514. _mesa_meta_DrawPixels(struct gl_context *ctx,
  515.                       GLint x, GLint y, GLsizei width, GLsizei height,
  516.                       GLenum format, GLenum type,
  517.                       const struct gl_pixelstore_attrib *unpack,
  518.                       const GLvoid *pixels);
  519.  
  520. extern void
  521. _mesa_meta_Bitmap(struct gl_context *ctx,
  522.                   GLint x, GLint y, GLsizei width, GLsizei height,
  523.                   const struct gl_pixelstore_attrib *unpack,
  524.                   const GLubyte *bitmap);
  525.  
  526. extern void
  527. _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
  528.                           struct gl_texture_object *texObj);
  529.  
  530. extern bool
  531. _mesa_meta_pbo_TexSubImage(struct gl_context *ctx, GLuint dims,
  532.                            struct gl_texture_image *tex_image,
  533.                            int xoffset, int yoffset, int zoffset,
  534.                            int width, int height, int depth,
  535.                            GLenum format, GLenum type, const void *pixels,
  536.                            bool allocate_storage, bool create_pbo,
  537.                            const struct gl_pixelstore_attrib *packing);
  538.  
  539. extern bool
  540. _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, GLuint dims,
  541.                               struct gl_texture_image *tex_image,
  542.                               int xoffset, int yoffset, int zoffset,
  543.                               int width, int height, int depth,
  544.                               GLenum format, GLenum type, const void *pixels,
  545.                               const struct gl_pixelstore_attrib *packing);
  546.  
  547. extern void
  548. _mesa_meta_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
  549.                            struct gl_texture_image *texImage,
  550.                            GLint xoffset, GLint yoffset, GLint slice,
  551.                            struct gl_renderbuffer *rb,
  552.                            GLint x, GLint y,
  553.                            GLsizei width, GLsizei height);
  554.  
  555. extern void
  556. _mesa_meta_ClearTexSubImage(struct gl_context *ctx,
  557.                             struct gl_texture_image *texImage,
  558.                             GLint xoffset, GLint yoffset, GLint zoffset,
  559.                             GLsizei width, GLsizei height, GLsizei depth,
  560.                             const GLvoid *clearValue);
  561.  
  562. extern void
  563. _mesa_meta_GetTexImage(struct gl_context *ctx,
  564.                        GLenum format, GLenum type, GLvoid *pixels,
  565.                        struct gl_texture_image *texImage);
  566.  
  567. extern void
  568. _mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
  569.                    GLfloat width, GLfloat height);
  570.  
  571. /* meta-internal functions */
  572. void
  573. _mesa_meta_drawbuffers_from_bitfield(GLbitfield bits);
  574.  
  575. GLuint
  576. _mesa_meta_compile_shader_with_debug(struct gl_context *ctx, GLenum target,
  577.                                      const GLcharARB *source);
  578.  
  579.  
  580. GLuint
  581. _mesa_meta_link_program_with_debug(struct gl_context *ctx, GLuint program);
  582.  
  583. void
  584. _mesa_meta_compile_and_link_program(struct gl_context *ctx,
  585.                                     const char *vs_source,
  586.                                     const char *fs_source,
  587.                                     const char *name,
  588.                                     GLuint *program);
  589.  
  590. GLboolean
  591. _mesa_meta_alloc_texture(struct temp_texture *tex,
  592.                          GLsizei width, GLsizei height, GLenum intFormat);
  593.  
  594. void
  595. _mesa_meta_setup_texture_coords(GLenum faceTarget,
  596.                                 GLint slice,
  597.                                 GLint width,
  598.                                 GLint height,
  599.                                 GLint depth,
  600.                                 GLfloat coords0[4],
  601.                                 GLfloat coords1[4],
  602.                                 GLfloat coords2[4],
  603.                                 GLfloat coords3[4]);
  604.  
  605. struct temp_texture *
  606. _mesa_meta_get_temp_texture(struct gl_context *ctx);
  607.  
  608. struct temp_texture *
  609. _mesa_meta_get_temp_depth_texture(struct gl_context *ctx);
  610.  
  611. void
  612. _mesa_meta_setup_vertex_objects(GLuint *VAO, GLuint *VBO,
  613.                                 bool use_generic_attributes,
  614.                                 unsigned vertex_size, unsigned texcoord_size,
  615.                                 unsigned color_size);
  616.  
  617. void
  618. _mesa_meta_setup_ff_tnl_for_blit(GLuint *VAO, GLuint *VBO,
  619.                                  unsigned texcoord_size);
  620.  
  621. void
  622. _mesa_meta_setup_drawpix_texture(struct gl_context *ctx,
  623.                                  struct temp_texture *tex,
  624.                                  GLboolean newTex,
  625.                                  GLsizei width, GLsizei height,
  626.                                  GLenum format, GLenum type,
  627.                                  const GLvoid *pixels);
  628.  
  629. void
  630. _mesa_meta_setup_copypix_texture(struct gl_context *ctx,
  631.                                  struct temp_texture *tex,
  632.                                  GLint srcX, GLint srcY,
  633.                                  GLsizei width, GLsizei height,
  634.                                  GLenum intFormat,
  635.                                  GLenum filter);
  636.  
  637. void
  638. _mesa_meta_setup_blit_shader(struct gl_context *ctx,
  639.                              GLenum target,
  640.                              bool do_depth,
  641.                              struct blit_shader_table *table);
  642.  
  643. void
  644. _mesa_meta_glsl_blit_cleanup(struct blit_state *blit);
  645.  
  646. void
  647. _mesa_meta_blit_shader_table_cleanup(struct blit_shader_table *table);
  648.  
  649. void
  650. _mesa_meta_glsl_generate_mipmap_cleanup(struct gen_mipmap_state *mipmap);
  651.  
  652. void
  653. _mesa_meta_bind_fbo_image(GLenum target, GLenum attachment,
  654.                           struct gl_texture_image *texImage, GLuint layer);
  655.  
  656. #endif /* META_H */
  657.