xref: /aosp_15_r20/external/mesa3d/src/mesa/state_tracker/st_cb_texture.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /**************************************************************************
2  *
3  * Copyright 2007 VMware, Inc.
4  * 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
8  * "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish,
10  * distribute, sub license, and/or sell copies of the Software, and to
11  * permit persons to whom the Software is furnished to do so, subject to
12  * the following conditions:
13  *
14  * The above copyright notice and this permission notice (including the
15  * next paragraph) shall be included in all copies or substantial portions
16  * of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21  * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25  *
26  **************************************************************************/
27 
28 
29 #ifndef ST_CB_TEXTURE_H
30 #define ST_CB_TEXTURE_H
31 
32 
33 #include "util/glheader.h"
34 
35 struct dd_function_table;
36 struct gl_context;
37 struct gl_texture_object;
38 struct gl_texture_image;
39 struct pipe_context;
40 struct st_context;
41 struct gl_renderbuffer;
42 struct gl_pixelstore_attrib;
43 struct gl_memory_object;
44 struct gl_sampler_object;
45 
46 enum pipe_texture_target
47 gl_target_to_pipe(GLenum target);
48 
49 extern GLint
50 st_from_pipe_compression_rate(uint32_t rate);
51 
52 unsigned
53 st_get_blit_mask(GLenum srcFormat, GLenum dstFormat);
54 
55 extern GLboolean
56 st_finalize_texture(struct gl_context *ctx,
57 		    struct pipe_context *pipe,
58 		    struct gl_texture_object *tObj,
59 		    GLuint cubeMapFace);
60 
61 void st_FreeTextureImageBuffer(struct gl_context *ctx,
62                                struct gl_texture_image *texImage);
63 void st_MapTextureImage(struct gl_context *ctx,
64                         struct gl_texture_image *texImage,
65                         GLuint slice, GLuint x, GLuint y, GLuint w, GLuint h,
66                         GLbitfield mode,
67                         GLubyte **mapOut, GLint *rowStrideOut);
68 void st_UnmapTextureImage(struct gl_context *ctx,
69                           struct gl_texture_image *texImage,
70                           GLuint slice);
71 GLboolean st_AllocTextureImageBuffer(struct gl_context *ctx,
72                                      struct gl_texture_image *texImage);
73 void st_TexSubImage(struct gl_context *ctx, GLuint dims,
74                     struct gl_texture_image *texImage,
75                     GLint xoffset, GLint yoffset, GLint zoffset,
76                     GLint width, GLint height, GLint depth,
77                     GLenum format, GLenum type, const void *pixels,
78                     const struct gl_pixelstore_attrib *unpack);
79 void st_TexImage(struct gl_context * ctx, GLuint dims,
80                  struct gl_texture_image *texImage,
81                  GLenum format, GLenum type, const void *pixels,
82                  const struct gl_pixelstore_attrib *unpack);
83 void st_CompressedTexSubImage(struct gl_context *ctx, GLuint dims,
84                               struct gl_texture_image *texImage,
85                               GLint x, GLint y, GLint z,
86                               GLsizei w, GLsizei h, GLsizei d,
87                               GLenum format, GLsizei imageSize, const void *data);
88 void st_CompressedTexImage(struct gl_context *ctx, GLuint dims,
89                            struct gl_texture_image *texImage,
90                            GLsizei imageSize, const void *data);
91 void st_GetTexSubImage(struct gl_context * ctx,
92                        GLint xoffset, GLint yoffset, GLint zoffset,
93                        GLsizei width, GLsizei height, GLint depth,
94                        GLenum format, GLenum type, void * pixels,
95                        struct gl_texture_image *texImage);
96 void st_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
97                         struct gl_texture_image *texImage,
98                         GLint destX, GLint destY, GLint slice,
99                         struct gl_renderbuffer *rb,
100                         GLint srcX, GLint srcY, GLsizei width, GLsizei height);
101 GLboolean st_AllocTextureStorage(struct gl_context *ctx,
102                                  struct gl_texture_object *texObj,
103                                  GLsizei levels, GLsizei width,
104                                  GLsizei height, GLsizei depth,
105                                  const char *func);
106 GLboolean st_TestProxyTexImage(struct gl_context *ctx, GLenum target,
107                                GLuint numLevels, GLint level,
108                                mesa_format format, GLuint numSamples,
109                                GLint width, GLint height, GLint depth);
110 GLboolean st_TextureView(struct gl_context *ctx,
111                          struct gl_texture_object *texObj,
112                          struct gl_texture_object *origTexObj);
113 void st_ClearTexSubImage(struct gl_context *ctx,
114                          struct gl_texture_image *texImage,
115                          GLint xoffset, GLint yoffset, GLint zoffset,
116                          GLsizei width, GLsizei height, GLsizei depth,
117                          const void *clearValue);
118 GLboolean st_SetTextureStorageForMemoryObject(struct gl_context *ctx,
119                                               struct gl_texture_object *texObj,
120                                               struct gl_memory_object *memObj,
121                                               GLsizei levels, GLsizei width,
122                                               GLsizei height, GLsizei depth,
123                                               GLuint64 offset,
124                                               const char *func);
125 
126 GLboolean st_GetSparseTextureVirtualPageSize(struct gl_context *ctx,
127                                              GLenum target, mesa_format format,
128                                              unsigned index, int *x, int *y, int *z);
129 void st_TexturePageCommitment(struct gl_context *ctx,
130                               struct gl_texture_object *tex_obj,
131                               int level, int xoffset, int yoffset, int zoffset,
132                               int width, int height, int depth, bool commit);
133 #endif /* ST_CB_TEXTURE_H */
134