1 /**************************************************************************
3 * Copyright 2013-2014 RAD Game Tools and Valve Software
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 **************************************************************************/
26 // File: vogl_msaa_texture.h
28 #ifndef VOGL_MSAA_TEXTURE_H
29 #define VOGL_MSAA_TEXTURE_H
31 #include "vogl_core.h"
32 #include "vogl_ktx_texture.h"
33 #include "vogl_context_info.h"
34 #include "vogl_gl_utils.h"
35 #include "vogl_shader_utils.h"
37 class vogl_msaa_texture_splitter
39 VOGL_NO_COPY_OR_ASSIGNMENT_OP(vogl_msaa_texture_splitter);
42 vogl_msaa_texture_splitter();
43 ~vogl_msaa_texture_splitter();
48 bool is_valid() const { return m_valid; }
50 // Splits an MSAA texture to 1 or more non-MSAA textures.
51 // One multisampled source, multiple non-multisampled destinations created by method.
52 bool split(GLenum src_target, GLuint src_texture, vogl::vector<GLuint> &dest_textures);
54 // Copies texels from a non-MSAA texture into a single sample of a MSAA texture.
55 // Multiple sources, one multisampled destination. Caller creates destination.
56 bool combine(GLuint src_texture, uint dest_sample_index, GLenum dest_target, GLuint dest_texture);
58 // Copies MSAA stencil samples from an MSAA 2D to 2D_ARRAY texture to a MSAA 2D or 2D_ARRAY color texture.
59 bool copy_stencil_samples_to_color(GLenum target, GLuint src_texture, GLuint &dest_texture);
61 // Copies MSAA color samples from an MSAA 2D to 2D_ARRAY texture to the stencil buffer of a MSAA 2D or 2D_ARRAY depth/stencil texture.
62 bool copy_color_sample_to_stencil(GLuint src_texture, uint dest_sample_index, GLenum dest_target, GLuint dest_texture);
65 vogl_context_info m_context_info;
68 GLuint m_vertex_buffer;
70 vogl_gl_context m_orig_context;
71 vogl_gl_context m_work_context;
72 vogl_gl_display m_cur_display;
73 vogl_gl_fb_config m_cur_fb_config;
74 vogl_gl_drawable m_cur_drawable;
76 vogl_simple_gl_program m_read_color_program;
77 vogl_simple_gl_program m_read_color_array_program;
78 vogl_simple_gl_program m_read_depth_program;
79 vogl_simple_gl_program m_read_depth_array_program;
81 vogl_simple_gl_program m_write_color_program;
82 vogl_simple_gl_program m_write_color_array_program;
83 vogl_simple_gl_program m_write_depth_program;
84 vogl_simple_gl_program m_write_depth_array_program;
86 vogl_simple_gl_program m_const_color_program;
88 vogl_simple_gl_program m_write_stencil_program;
89 vogl_simple_gl_program m_write_stencil_array_program;
94 #endif // VOGL_MSAA_TEXTURE_H