1 #include <msp/gl/extensions/arb_direct_state_access.h>
2 #include <msp/gl/extensions/arb_texture_multisample.h>
3 #include <msp/gl/extensions/arb_texture_storage_multisample.h>
4 #include "deviceinfo.h"
6 #include "texture2dmultisample.h"
13 Texture2DMultisample::Texture2DMultisample():
14 Texture(GL_TEXTURE_2D_MULTISAMPLE),
18 static Require _req(ARB_texture_multisample);
21 void Texture2DMultisample::storage(PixelFormat fmt, unsigned wd, unsigned ht, unsigned sm)
25 if(fmt!=format || wd!=width || ht!=height || sm!=samples)
26 throw incompatible_data("Texture2DMultisample::storage");
30 throw invalid_argument("Texture2DMultisample::storage");
31 if(!sm || sm>Limits::get_global().max_samples)
32 throw invalid_argument("Texture2DMultisample::storage");
39 GLenum gl_fmt = get_gl_pixelformat(storage_fmt);
40 if(ARB_texture_storage_multisample)
42 if(ARB_direct_state_access)
43 glTextureStorage2DMultisample(id, samples, gl_fmt, width, height, false);
47 glTexStorage2DMultisample(target, samples, gl_fmt, width, height, false);
53 glTexImage2DMultisample(target, samples, gl_fmt, width, height, false);
58 void Texture2DMultisample::image(const Graphics::Image &, unsigned)
60 throw invalid_operation("Texture2DMultisample::image");
63 UInt64 Texture2DMultisample::get_data_size() const
65 return id ? width*height*get_pixel_size(format)*samples : 0;