]> git.tdb.fi Git - libs/gl.git/blob - source/core/texture2dmultisample.cpp
Set mip levels of multisample textures to 1
[libs/gl.git] / source / core / texture2dmultisample.cpp
1 #include "device.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>Device::get_current().get_info().limits.max_samples)
21                 throw invalid_argument("Texture2DMultisample::storage");
22
23         set_format(fmt);
24         width = wd;
25         height = ht;
26         samples = sm;
27         n_levels = 1;
28
29         allocate();
30 }
31
32 void Texture2DMultisample::image(unsigned, const void *)
33 {
34         throw invalid_operation("Texture2DMultisample::image");
35 }
36
37 void Texture2DMultisample::image(const Graphics::Image &, unsigned)
38 {
39         throw invalid_operation("Texture2DMultisample::image");
40 }
41
42 } // namespace GL
43 } // namespace Msp