2
* Copyright 2016 Advanced Micro Devices, Inc.
4
* Permission is hereby granted, free of charge, to any person obtaining a
5
* copy of this software and associated documentation files (the "Software"),
6
* to deal in the Software without restriction, including without limitation
7
* on the rights to use, copy, modify, merge, publish, distribute, sub
8
* license, and/or sell copies of the Software, and to permit persons to whom
9
* the Software is furnished to do so, subject to the following conditions:
11
* The above copyright notice and this permission notice (including the next
12
* paragraph) shall be included in all copies or substantial portions of the
15
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18
* THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21
* USE OR OTHER DEALINGS IN THE SOFTWARE.
27
struct gl_pixelstore_attrib;
31
struct st_pbo_addresses {
38
unsigned bytes_per_pixel;
40
/* Everything below is filled in by st_pbo_from_pixelstore */
41
unsigned pixels_per_row;
42
unsigned image_height;
44
/* Everything below is filled in by st_pbo_setup_buffer */
46
/* Buffer and view. */
47
struct pipe_resource *buffer; /* non-owning pointer */
48
unsigned first_element;
49
unsigned last_element;
51
/* Constant buffer for the fragment shader. */
61
/* Conversion to apply in the fragment shader. */
62
enum st_pbo_conversion {
63
ST_PBO_CONVERT_FLOAT = 0,
66
ST_PBO_CONVERT_UINT_TO_SINT,
67
ST_PBO_CONVERT_SINT_TO_UINT,
69
ST_NUM_PBO_CONVERSIONS
72
const struct glsl_type *
73
st_pbo_sampler_type_for_target(enum pipe_texture_target target,
74
enum st_pbo_conversion conv);
76
st_pbo_addresses_setup(struct st_context *st,
77
struct pipe_resource *buf, intptr_t buf_offset,
78
struct st_pbo_addresses *addr);
81
st_pbo_addresses_pixelstore(struct st_context *st,
82
GLenum gl_target, bool skip_images,
83
const struct gl_pixelstore_attrib *store,
85
struct st_pbo_addresses *addr);
88
st_pbo_addresses_invert_y(struct st_pbo_addresses *addr,
89
unsigned viewport_height);
92
st_pbo_draw(struct st_context *st, const struct st_pbo_addresses *addr,
93
unsigned surface_width, unsigned surface_height);
96
st_pbo_create_vs(struct st_context *st);
99
st_pbo_create_gs(struct st_context *st);
102
st_pbo_get_upload_fs(struct st_context *st,
103
enum pipe_format src_format,
104
enum pipe_format dst_format,
108
st_pbo_get_download_fs(struct st_context *st, enum pipe_texture_target target,
109
enum pipe_format src_format,
110
enum pipe_format dst_format,
114
st_GetTexSubImage_shader(struct gl_context * ctx,
115
GLint xoffset, GLint yoffset, GLint zoffset,
116
GLsizei width, GLsizei height, GLint depth,
117
GLenum format, GLenum type, void * pixels,
118
struct gl_texture_image *texImage);
121
st_pbo_get_dst_format(struct gl_context *ctx, enum pipe_texture_target target,
122
enum pipe_format src_format, bool is_compressed,
123
GLenum format, GLenum type, unsigned bind);
125
st_pbo_get_src_format(struct pipe_screen *screen, enum pipe_format src_format, struct pipe_resource *src);
128
st_init_pbo_helpers(struct st_context *st);
131
st_destroy_pbo_helpers(struct st_context *st);
133
#endif /* ST_PBO_H */