]> git.tdb.fi Git - libs/gl.git/blob - source/core/texture2dmultisample.cpp
Use default member initializers for simple types
[libs/gl.git] / source / core / texture2dmultisample.cpp
1 #include "deviceinfo.h"
2 #include "error.h"
3 #include "texture2dmultisample.h"
4
5 using namespace std;
6
7 namespace Msp {
8 namespace GL {
9
10 void Texture2DMultisample::storage(PixelFormat fmt, unsigned wd, unsigned ht, unsigned sm)
11 {
12         if(width>0)
13         {
14                 if(fmt!=format || wd!=width || ht!=height || sm!=samples)
15                         throw incompatible_data("Texture2DMultisample::storage");
16                 return;
17         }
18         if(wd==0 || ht==0)
19                 throw invalid_argument("Texture2DMultisample::storage");
20         if(!sm || sm>DeviceInfo::get_global().limits.max_samples)
21                 throw invalid_argument("Texture2DMultisample::storage");
22
23         set_format(fmt);
24         width = wd;
25         height = ht;
26         samples = sm;
27
28         allocate();
29 }
30
31 void Texture2DMultisample::image(const Graphics::Image &, unsigned)
32 {
33         throw invalid_operation("Texture2DMultisample::image");
34 }
35
36 uint64_t Texture2DMultisample::get_data_size() const
37 {
38         return id ? width*height*get_pixel_size(format)*samples : 0;
39 }
40
41 } // namespace GL
42 } // namespace Msp