2 * Copyright 2016 VMware, Inc.
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sub license, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial portions
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
20 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
21 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 #ifndef ST_SAMPLER_VIEW_H
28 #define ST_SAMPLER_VIEW_H
30 #include "pipe/p_compiler.h"
31 #include "pipe/p_context.h"
32 #include "pipe/p_state.h"
33 #include "util/u_sampler.h"
35 struct st_texture_object
;
38 static inline struct pipe_sampler_view
*
39 st_create_texture_sampler_view_format(struct pipe_context
*pipe
,
40 struct pipe_resource
*texture
,
41 enum pipe_format format
)
43 struct pipe_sampler_view templ
;
45 u_sampler_view_default_template(&templ
, texture
, format
);
47 return pipe
->create_sampler_view(pipe
, texture
, &templ
);
51 static inline struct pipe_sampler_view
*
52 st_create_texture_sampler_view(struct pipe_context
*pipe
,
53 struct pipe_resource
*texture
)
55 return st_create_texture_sampler_view_format(pipe
, texture
,
61 st_texture_release_context_sampler_view(struct st_context
*st
,
62 struct st_texture_object
*stObj
);
65 st_texture_release_all_sampler_views(struct st_context
*st
,
66 struct st_texture_object
*stObj
);
69 st_delete_texture_sampler_views(struct st_context
*st
,
70 struct st_texture_object
*stObj
);
72 const struct st_sampler_view
*
73 st_texture_get_current_sampler_view(const struct st_context
*st
,
74 const struct st_texture_object
*stObj
);
76 struct pipe_sampler_view
*
77 st_get_texture_sampler_view_from_stobj(struct st_context
*st
,
78 struct st_texture_object
*stObj
,
79 const struct gl_sampler_object
*samp
,
80 bool glsl130_or_later
,
81 bool ignore_srgb_decode
);
83 struct pipe_sampler_view
*
84 st_get_buffer_sampler_view_from_stobj(struct st_context
*st
,
85 struct st_texture_object
*stObj
);
87 #endif /* ST_SAMPLER_VIEW_H */