@@ -63,13 +63,19 @@ module Graphics.Rendering.OpenGL.GL.Texturing.Specification (
63
63
compressedTexSubImage1D , compressedTexSubImage2D , compressedTexSubImage3D ,
64
64
getCompressedTexImage ,
65
65
66
- -- * Implementation-Dependent Limits
67
- maxTextureSize , maxCubeMapTextureSize , maxRectangleTextureSize ,
68
- max3DTextureSize , maxArrayTextureLayers
66
+ -- * Multisample Texture Images
67
+ SampleLocations (.. ), texImage2DMultisample , texImage3DMultisample ,
68
+
69
+ -- * Implementation-Dependent Limits
70
+ maxTextureSize , maxCubeMapTextureSize , maxRectangleTextureSize ,
71
+ max3DTextureSize , maxArrayTextureLayers , maxSampleMaskWords ,
72
+ maxColorTextureSamples , maxDepthTextureSamples , maxIntegerSamples
69
73
) where
70
74
71
75
import Foreign.Ptr
72
76
import Graphics.Rendering.OpenGL.GL.CoordTrans
77
+ import Graphics.Rendering.OpenGL.GL.FramebufferObjects.RenderbufferTarget
78
+ import Graphics.Rendering.OpenGL.GL.GLboolean
73
79
import Graphics.Rendering.OpenGL.GL.PixelData
74
80
import Graphics.Rendering.OpenGL.GL.PixelRectangles
75
81
import Graphics.Rendering.OpenGL.GL.QueryUtils
@@ -339,6 +345,54 @@ compressedTexSubImage3D target level (TexturePosition3D xOff yOff zOff) (Texture
339
345
340
346
--------------------------------------------------------------------------------
341
347
348
+ data SampleLocations =
349
+ FlexibleSampleLocations
350
+ | FixedSampleLocations
351
+ deriving ( Eq , Ord , Show )
352
+
353
+ marshalSampleLocations :: SampleLocations -> GLboolean
354
+ marshalSampleLocations = marshalGLboolean . (FixedSampleLocations == )
355
+
356
+ {-
357
+ unmarshalSampleLocations :: GLboolean -> SampleLocations
358
+ unmarshalSampleLocations x =
359
+ if unmarshalGLboolean x
360
+ then FixedSampleLocations
361
+ else FlexibleSampleLocations
362
+ -}
363
+
364
+ --------------------------------------------------------------------------------
365
+
366
+ texImage2DMultisample :: TextureTarget2DMultisample
367
+ -> Proxy
368
+ -> Samples
369
+ -> PixelInternalFormat
370
+ -> TextureSize2D
371
+ -> SampleLocations
372
+ -> IO ()
373
+ texImage2DMultisample target proxy (Samples s) int (TextureSize2D w h) loc =
374
+ glTexImage2DMultisample
375
+ (marshalMultisample proxy target) s (marshalPixelInternalFormat int)
376
+ w h (marshalSampleLocations loc)
377
+
378
+ marshalMultisample :: ParameterizedTextureTarget t => Proxy -> t -> GLenum
379
+ marshalMultisample proxy = case proxy of
380
+ NoProxy -> marshalParameterizedTextureTarget
381
+ Proxy -> marshalParameterizedTextureTargetProxy
382
+
383
+ texImage3DMultisample :: TextureTarget2DMultisampleArray
384
+ -> Proxy
385
+ -> Samples
386
+ -> PixelInternalFormat
387
+ -> TextureSize3D
388
+ -> SampleLocations
389
+ -> IO ()
390
+ texImage3DMultisample target proxy (Samples s) int (TextureSize3D w h d) loc =
391
+ glTexImage3DMultisample
392
+ (marshalMultisample proxy target) s (marshalPixelInternalFormat int)
393
+ w h d (marshalSampleLocations loc)
394
+
395
+ --------------------------------------------------------------------------------
342
396
maxTextureSize :: GettableStateVar GLsizei
343
397
maxTextureSize = maxTextureSizeWith GetMaxTextureSize
344
398
@@ -354,5 +408,17 @@ max3DTextureSize = maxTextureSizeWith GetMax3DTextureSize
354
408
maxArrayTextureLayers :: GettableStateVar GLsizei
355
409
maxArrayTextureLayers = maxTextureSizeWith GetMaxArrayTextureLayers
356
410
411
+ maxSampleMaskWords :: GettableStateVar GLsizei
412
+ maxSampleMaskWords = maxTextureSizeWith GetMaxSampleMaskWords
413
+
414
+ maxColorTextureSamples :: GettableStateVar GLsizei
415
+ maxColorTextureSamples = maxTextureSizeWith GetMaxColorTextureSamples
416
+
417
+ maxDepthTextureSamples :: GettableStateVar GLsizei
418
+ maxDepthTextureSamples = maxTextureSizeWith GetMaxDepthTextureSamples
419
+
420
+ maxIntegerSamples :: GettableStateVar GLsizei
421
+ maxIntegerSamples = maxTextureSizeWith GetMaxIntegerSamples
422
+
357
423
maxTextureSizeWith :: PName1I -> GettableStateVar GLsizei
358
424
maxTextureSizeWith = makeGettableStateVar . getInteger1 fromIntegral
0 commit comments