aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/drivers/common/meta.h
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-03-04 08:57:07 +0100
committermarha <marha@users.sourceforge.net>2014-03-04 08:57:07 +0100
commit321c01267ae1c446f1bd22b642567fcafa016c02 (patch)
tree69f6e12bdfd1ccda5d054398321bc1876dd3fc89 /mesalib/src/mesa/drivers/common/meta.h
parent982ac918afe6a1c02d5cf735d7b6c56443a048cc (diff)
downloadvcxsrv-321c01267ae1c446f1bd22b642567fcafa016c02.tar.gz
vcxsrv-321c01267ae1c446f1bd22b642567fcafa016c02.tar.bz2
vcxsrv-321c01267ae1c446f1bd22b642567fcafa016c02.zip
libX11 libxcb mesa xserver xcb-proto xkeyboard-config git update 4 Mar 2014
xserver commit b634e909895f6001e7d9543e1350b20c82c8c01c libxcb commit 4ffa6f83b92763eb901c7ddb7c20775e24d507ca libxcb/xcb-proto commit 4270141a7cb3c68f50251be19a5a628aa18553e6 xkeyboard-config commit d9e3d0ec1a48a5f61ea6dd6d20b8682eeecf3a39 libX11 commit d6bd988bc00494914b38b95ee5df77ac4f32f19f libXdmcp commit 089081dca4ba3598c6f9bf401c029378943b5854 libXext commit d5447c0156f556114dbf97d6064c0c7b0fcd5f70 libfontenc commit 0037a42107b952c9d903719615747e760e4e7247 libXinerama commit edd95182b26eb5d576d4878c559e0f17dddaa909 libXau commit 1e4635be11154dd8262f37b379511bd627defa2a xkbcomp commit 31b90ee4ffc774e0da540277907fc5540c0b012c pixman commit 82d094654a46bd97d47f1f132a01ae0a74b986f3 xextproto commit 66afec3f49e8eb0d4c2e9af7088fc3116d4bafd7 randrproto commit a4a6694c059d74247c16527eef4a0ec9f56bbef6 glproto commit f84853d97d5749308992412a215fa518b6536eb3 mkfontscale commit eac564e0fc9052a39981ea47b271f7f3d2821944 xwininfo commit ba0d1b0da21d2dbdd81098ed5778f3792b472e13 libXft commit 4acfdaf95adb0a05c2a25550bdde036c865902f4 libXmu commit 22d9c590901e121936f50dee97dc60c4f7defb63 libxtrans commit 3f0de269abe59353acbd7a5587d68ce0da91db67 fontconfig commit e310d2fac2d874d5aa76c609df70cc7b871c0b6d mesa commit 1a568e0f2b65e4e1e1d19a6dece3a792a33da825
Diffstat (limited to 'mesalib/src/mesa/drivers/common/meta.h')
-rw-r--r--mesalib/src/mesa/drivers/common/meta.h361
1 files changed, 361 insertions, 0 deletions
diff --git a/mesalib/src/mesa/drivers/common/meta.h b/mesalib/src/mesa/drivers/common/meta.h
index 53d7b8ab5..fcf45c403 100644
--- a/mesalib/src/mesa/drivers/common/meta.h
+++ b/mesalib/src/mesa/drivers/common/meta.h
@@ -60,6 +60,311 @@
#define MESA_META_OCCLUSION_QUERY 0x400000
/**\}*/
+/**
+ * State which we may save/restore across meta ops.
+ * XXX this may be incomplete...
+ */
+struct save_state
+{
+ GLbitfield SavedState; /**< bitmask of MESA_META_* flags */
+
+ /* Always saved/restored with meta. */
+ gl_api API;
+
+ /** MESA_META_CLEAR (and others?) */
+ struct gl_query_object *CurrentOcclusionObject;
+
+ /** MESA_META_ALPHA_TEST */
+ GLboolean AlphaEnabled;
+ GLenum AlphaFunc;
+ GLclampf AlphaRef;
+
+ /** MESA_META_BLEND */
+ GLbitfield BlendEnabled;
+ GLboolean ColorLogicOpEnabled;
+
+ /** MESA_META_COLOR_MASK */
+ GLubyte ColorMask[MAX_DRAW_BUFFERS][4];
+
+ /** MESA_META_DEPTH_TEST */
+ struct gl_depthbuffer_attrib Depth;
+
+ /** MESA_META_FOG */
+ GLboolean Fog;
+
+ /** MESA_META_PIXEL_STORE */
+ struct gl_pixelstore_attrib Pack, Unpack;
+
+ /** MESA_META_PIXEL_TRANSFER */
+ GLfloat RedBias, RedScale;
+ GLfloat GreenBias, GreenScale;
+ GLfloat BlueBias, BlueScale;
+ GLfloat AlphaBias, AlphaScale;
+ GLfloat DepthBias, DepthScale;
+ GLboolean MapColorFlag;
+
+ /** MESA_META_RASTERIZATION */
+ GLenum FrontPolygonMode, BackPolygonMode;
+ GLboolean PolygonOffset;
+ GLboolean PolygonSmooth;
+ GLboolean PolygonStipple;
+ GLboolean PolygonCull;
+
+ /** MESA_META_SCISSOR */
+ struct gl_scissor_attrib Scissor;
+
+ /** MESA_META_SHADER */
+ GLboolean VertexProgramEnabled;
+ struct gl_vertex_program *VertexProgram;
+ GLboolean FragmentProgramEnabled;
+ struct gl_fragment_program *FragmentProgram;
+ GLboolean ATIFragmentShaderEnabled;
+ struct gl_shader_program *Shader[MESA_SHADER_STAGES];
+ struct gl_shader_program *ActiveShader;
+
+ /** MESA_META_STENCIL_TEST */
+ struct gl_stencil_attrib Stencil;
+
+ /** MESA_META_TRANSFORM */
+ GLenum MatrixMode;
+ GLfloat ModelviewMatrix[16];
+ GLfloat ProjectionMatrix[16];
+ GLfloat TextureMatrix[16];
+
+ /** MESA_META_CLIP */
+ GLbitfield ClipPlanesEnabled;
+
+ /** MESA_META_TEXTURE */
+ GLuint ActiveUnit;
+ GLuint ClientActiveUnit;
+ /** for unit[0] only */
+ struct gl_texture_object *CurrentTexture[NUM_TEXTURE_TARGETS];
+ /** mask of TEXTURE_2D_BIT, etc */
+ GLbitfield TexEnabled[MAX_TEXTURE_UNITS];
+ GLbitfield TexGenEnabled[MAX_TEXTURE_UNITS];
+ GLuint EnvMode; /* unit[0] only */
+
+ /** MESA_META_VERTEX */
+ struct gl_vertex_array_object *VAO;
+ struct gl_buffer_object *ArrayBufferObj;
+
+ /** MESA_META_VIEWPORT */
+ GLfloat ViewportX, ViewportY, ViewportW, ViewportH;
+ GLclampd DepthNear, DepthFar;
+
+ /** MESA_META_CLAMP_FRAGMENT_COLOR */
+ GLenum ClampFragmentColor;
+
+ /** MESA_META_CLAMP_VERTEX_COLOR */
+ GLenum ClampVertexColor;
+
+ /** MESA_META_CONDITIONAL_RENDER */
+ struct gl_query_object *CondRenderQuery;
+ GLenum CondRenderMode;
+
+ /** MESA_META_SELECT_FEEDBACK */
+ GLenum RenderMode;
+ struct gl_selection Select;
+ struct gl_feedback Feedback;
+
+ /** MESA_META_MULTISAMPLE */
+ struct gl_multisample_attrib Multisample;
+
+ /** MESA_META_FRAMEBUFFER_SRGB */
+ GLboolean sRGBEnabled;
+
+ /** Miscellaneous (always disabled) */
+ GLboolean Lighting;
+ GLboolean RasterDiscard;
+ GLboolean TransformFeedbackNeedsResume;
+};
+
+/**
+ * Temporary texture used for glBlitFramebuffer, glDrawPixels, etc.
+ * This is currently shared by all the meta ops. But we could create a
+ * separate one for each of glDrawPixel, glBlitFramebuffer, glCopyPixels, etc.
+ */
+struct temp_texture
+{
+ GLuint TexObj;
+ GLenum Target; /**< GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE */
+ GLsizei MinSize; /**< Min texture size to allocate */
+ GLsizei MaxSize; /**< Max possible texture size */
+ GLboolean NPOT; /**< Non-power of two size OK? */
+ GLsizei Width, Height; /**< Current texture size */
+ GLenum IntFormat;
+ GLfloat Sright, Ttop; /**< right, top texcoords */
+};
+
+/**
+ * State for GLSL texture sampler which is used to generate fragment
+ * shader in _mesa_meta_generate_mipmap().
+ */
+struct blit_shader {
+ const char *type;
+ const char *func;
+ const char *texcoords;
+ GLuint shader_prog;
+};
+
+/**
+ * Table of all sampler types and shaders for accessing them.
+ */
+struct blit_shader_table {
+ struct blit_shader sampler_1d;
+ struct blit_shader sampler_2d;
+ struct blit_shader sampler_3d;
+ struct blit_shader sampler_rect;
+ struct blit_shader sampler_cubemap;
+ struct blit_shader sampler_1d_array;
+ struct blit_shader sampler_2d_array;
+ struct blit_shader sampler_cubemap_array;
+};
+
+/**
+ * Indices in the blit_state->msaa_shaders[] array
+ *
+ * Note that setup_glsl_msaa_blit_shader() assumes that the _INT enums are one
+ * more than the non-_INT version and _UINT is one beyond that.
+ */
+enum blit_msaa_shader {
+ BLIT_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE,
+ BLIT_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_INT,
+ BLIT_MSAA_SHADER_2D_MULTISAMPLE_RESOLVE_UINT,
+ BLIT_MSAA_SHADER_2D_MULTISAMPLE_COPY,
+ BLIT_MSAA_SHADER_2D_MULTISAMPLE_COPY_INT,
+ BLIT_MSAA_SHADER_2D_MULTISAMPLE_COPY_UINT,
+ BLIT_MSAA_SHADER_2D_MULTISAMPLE_DEPTH_RESOLVE,
+ BLIT_MSAA_SHADER_2D_MULTISAMPLE_DEPTH_COPY,
+ BLIT_MSAA_SHADER_COUNT,
+};
+
+/**
+ * State for glBlitFramebufer()
+ */
+struct blit_state
+{
+ GLuint VAO;
+ GLuint VBO;
+ GLuint DepthFP;
+ struct blit_shader_table shaders;
+ GLuint msaa_shaders[BLIT_MSAA_SHADER_COUNT];
+ struct temp_texture depthTex;
+};
+
+
+/**
+ * State for glClear()
+ */
+struct clear_state
+{
+ GLuint VAO;
+ GLuint VBO;
+ GLuint ShaderProg;
+ GLint ColorLocation;
+ GLint LayerLocation;
+
+ GLuint IntegerShaderProg;
+ GLint IntegerColorLocation;
+ GLint IntegerLayerLocation;
+};
+
+
+/**
+ * State for glCopyPixels()
+ */
+struct copypix_state
+{
+ GLuint VAO;
+ GLuint VBO;
+};
+
+
+/**
+ * State for glDrawPixels()
+ */
+struct drawpix_state
+{
+ GLuint VAO;
+ GLuint VBO;
+
+ GLuint StencilFP; /**< Fragment program for drawing stencil images */
+ GLuint DepthFP; /**< Fragment program for drawing depth images */
+};
+
+
+/**
+ * State for glBitmap()
+ */
+struct bitmap_state
+{
+ GLuint VAO;
+ GLuint VBO;
+ struct temp_texture Tex; /**< separate texture from other meta ops */
+};
+
+/**
+ * State for _mesa_meta_generate_mipmap()
+ */
+struct gen_mipmap_state
+{
+ GLuint VAO;
+ GLuint VBO;
+ GLuint FBO;
+ GLuint Sampler;
+
+ struct blit_shader_table shaders;
+};
+
+/**
+ * State for texture decompression
+ */
+struct decompress_state
+{
+ GLuint VAO;
+ GLuint VBO, FBO, RBO, Sampler;
+ GLint Width, Height;
+
+ struct blit_shader_table shaders;
+};
+
+/**
+ * State for glDrawTex()
+ */
+struct drawtex_state
+{
+ GLuint VAO;
+ GLuint VBO;
+};
+
+#define MAX_META_OPS_DEPTH 8
+/**
+ * All per-context meta state.
+ */
+struct gl_meta_state
+{
+ /** Stack of state saved during meta-ops */
+ struct save_state Save[MAX_META_OPS_DEPTH];
+ /** Save stack depth */
+ GLuint SaveStackDepth;
+
+ struct temp_texture TempTex;
+
+ struct blit_state Blit; /**< For _mesa_meta_BlitFramebuffer() */
+ struct clear_state Clear; /**< For _mesa_meta_Clear() */
+ struct copypix_state CopyPix; /**< For _mesa_meta_CopyPixels() */
+ struct drawpix_state DrawPix; /**< For _mesa_meta_DrawPixels() */
+ struct bitmap_state Bitmap; /**< For _mesa_meta_Bitmap() */
+ struct gen_mipmap_state Mipmap; /**< For _mesa_meta_GenerateMipmap() */
+ struct decompress_state Decompress; /**< For texture decompression */
+ struct drawtex_state DrawTex; /**< For _mesa_meta_DrawTex() */
+};
+
+struct vertex {
+ GLfloat x, y, z, tex[4];
+ GLfloat r, g, b, a;
+};
+
extern void
_mesa_meta_init(struct gl_context *ctx);
@@ -130,4 +435,60 @@ extern void
_mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
GLfloat width, GLfloat height);
+/* meta-internal functions */
+GLuint
+_mesa_meta_compile_shader_with_debug(struct gl_context *ctx, GLenum target,
+ const GLcharARB *source);
+
+
+GLuint
+_mesa_meta_link_program_with_debug(struct gl_context *ctx, GLuint program);
+
+GLboolean
+_mesa_meta_alloc_texture(struct temp_texture *tex,
+ GLsizei width, GLsizei height, GLenum intFormat);
+
+struct temp_texture *
+_mesa_meta_get_temp_texture(struct gl_context *ctx);
+
+struct temp_texture *
+_mesa_meta_get_temp_depth_texture(struct gl_context *ctx);
+
+void
+_mesa_meta_setup_vertex_objects(GLuint *VAO, GLuint *VBO,
+ bool use_generic_attributes,
+ unsigned vertex_size, unsigned texcoord_size,
+ unsigned color_size);
+
+void
+_mesa_meta_setup_ff_tnl_for_blit(GLuint *VAO, GLuint *VBO,
+ unsigned texcoord_size);
+
+void
+_mesa_meta_setup_drawpix_texture(struct gl_context *ctx,
+ struct temp_texture *tex,
+ GLboolean newTex,
+ GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const GLvoid *pixels);
+
+void
+_mesa_meta_setup_copypix_texture(struct gl_context *ctx,
+ struct temp_texture *tex,
+ GLint srcX, GLint srcY,
+ GLsizei width, GLsizei height,
+ GLenum intFormat,
+ GLenum filter);
+
+void
+_mesa_meta_setup_blit_shader(struct gl_context *ctx,
+ GLenum target,
+ struct blit_shader_table *table);
+
+void
+_mesa_meta_glsl_blit_cleanup(struct blit_state *blit);
+
+void
+_mesa_meta_blit_shader_table_cleanup(struct blit_shader_table *table);
+
#endif /* META_H */