jsaddle-dom-0.10.0.0: src/JSDOM/Generated/GPUTextureDescriptor.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webgpu (webref). Do not edit.
module JSDOM.Generated.GPUTextureDescriptor
(newGPUTextureDescriptor, setSize, getSize, setMipLevelCount, getMipLevelCount, getMipLevelCountUnsafe, getMipLevelCountUnchecked, setSampleCount, getSampleCount, getSampleCountUnsafe, getSampleCountUnchecked, setDimension, getDimension, getDimensionUnsafe, getDimensionUnchecked, setFormat, getFormat, setUsage, getUsage, setViewFormats, getViewFormats, getViewFormatsUnsafe, getViewFormatsUnchecked, setTextureBindingViewDimension, getTextureBindingViewDimension, getTextureBindingViewDimensionUnsafe, getTextureBindingViewDimensionUnchecked, GPUTextureDescriptor(..), gTypeGPUTextureDescriptor)
where
import Prelude ((.), (==), (>>=), (<$>), (++), Bool(..), Maybe(..), IO, Int, Word, Double, Float)
import qualified Prelude as P
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import Language.Javascript.JSaddle (JSM, JSVal, JSString, toJSVal, valToBool, valToNumber, js, jss, jsf, jsg, new, function, asyncFunction, jsUndefined, jsNull)
import JSDOM.Types
import qualified JSDOM.Types as Types
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Generated.Enums
-- | <https://gpuweb.github.io/gpuweb/#gputexturedescriptor GPUTextureDescriptor specification>
newGPUTextureDescriptor :: (MonadDOM m, IsGPUExtent3D size) => size -> GPUTextureFormat -> Word -> m GPUTextureDescriptor
newGPUTextureDescriptor size format usage = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "size" (toJSVal size)) P.>> (o ^. jss "format" (toJSVal format)) P.>> (o ^. jss "usage" (toJSVal usage)) P.>> P.return o)) >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gputexturedescriptor-size GPUTextureDescriptor.size specification>
setSize :: (MonadDOM m, IsGPUExtent3D val) => GPUTextureDescriptor -> val -> m ()
setSize self val = liftDOM (void (self ^. jss "size" (toJSVal val)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gputexturedescriptor-size GPUTextureDescriptor.size specification>
getSize :: (MonadDOM m) => GPUTextureDescriptor -> m GPUExtent3D
getSize self = liftDOM (((self ^. js "size") >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gputexturedescriptor-miplevelcount GPUTextureDescriptor.mipLevelCount specification>
setMipLevelCount :: (MonadDOM m) => GPUTextureDescriptor -> Word -> m ()
setMipLevelCount self val = liftDOM (void (self ^. jss "mipLevelCount" (toJSVal val)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gputexturedescriptor-miplevelcount GPUTextureDescriptor.mipLevelCount specification>
getMipLevelCount :: (MonadDOM m) => GPUTextureDescriptor -> m (Maybe Word)
getMipLevelCount self = liftDOM (((self ^. js "mipLevelCount") >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gputexturedescriptor-miplevelcount GPUTextureDescriptor.mipLevelCount specification>
getMipLevelCountUnsafe :: (MonadDOM m, HasCallStack) => GPUTextureDescriptor -> m Word
getMipLevelCountUnsafe self = liftDOM ((((self ^. js "mipLevelCount") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://gpuweb.github.io/gpuweb/#dom-gputexturedescriptor-miplevelcount GPUTextureDescriptor.mipLevelCount specification>
getMipLevelCountUnchecked :: (MonadDOM m) => GPUTextureDescriptor -> m Word
getMipLevelCountUnchecked self = liftDOM ((P.round <$> ((self ^. js "mipLevelCount") >>= valToNumber)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gputexturedescriptor-samplecount GPUTextureDescriptor.sampleCount specification>
setSampleCount :: (MonadDOM m) => GPUTextureDescriptor -> Word -> m ()
setSampleCount self val = liftDOM (void (self ^. jss "sampleCount" (toJSVal val)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gputexturedescriptor-samplecount GPUTextureDescriptor.sampleCount specification>
getSampleCount :: (MonadDOM m) => GPUTextureDescriptor -> m (Maybe Word)
getSampleCount self = liftDOM (((self ^. js "sampleCount") >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gputexturedescriptor-samplecount GPUTextureDescriptor.sampleCount specification>
getSampleCountUnsafe :: (MonadDOM m, HasCallStack) => GPUTextureDescriptor -> m Word
getSampleCountUnsafe self = liftDOM ((((self ^. js "sampleCount") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://gpuweb.github.io/gpuweb/#dom-gputexturedescriptor-samplecount GPUTextureDescriptor.sampleCount specification>
getSampleCountUnchecked :: (MonadDOM m) => GPUTextureDescriptor -> m Word
getSampleCountUnchecked self = liftDOM ((P.round <$> ((self ^. js "sampleCount") >>= valToNumber)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gputexturedescriptor-dimension GPUTextureDescriptor.dimension specification>
setDimension :: (MonadDOM m) => GPUTextureDescriptor -> GPUTextureDimension -> m ()
setDimension self val = liftDOM (void (self ^. jss "dimension" (toJSVal val)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gputexturedescriptor-dimension GPUTextureDescriptor.dimension specification>
getDimension :: (MonadDOM m) => GPUTextureDescriptor -> m (Maybe GPUTextureDimension)
getDimension self = liftDOM (((self ^. js "dimension") >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gputexturedescriptor-dimension GPUTextureDescriptor.dimension specification>
getDimensionUnsafe :: (MonadDOM m, HasCallStack) => GPUTextureDescriptor -> m GPUTextureDimension
getDimensionUnsafe self = liftDOM ((((self ^. js "dimension") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://gpuweb.github.io/gpuweb/#dom-gputexturedescriptor-dimension GPUTextureDescriptor.dimension specification>
getDimensionUnchecked :: (MonadDOM m) => GPUTextureDescriptor -> m GPUTextureDimension
getDimensionUnchecked self = liftDOM (((self ^. js "dimension") >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gputexturedescriptor-format GPUTextureDescriptor.format specification>
setFormat :: (MonadDOM m) => GPUTextureDescriptor -> GPUTextureFormat -> m ()
setFormat self val = liftDOM (void (self ^. jss "format" (toJSVal val)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gputexturedescriptor-format GPUTextureDescriptor.format specification>
getFormat :: (MonadDOM m) => GPUTextureDescriptor -> m GPUTextureFormat
getFormat self = liftDOM (((self ^. js "format") >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gputexturedescriptor-usage GPUTextureDescriptor.usage specification>
setUsage :: (MonadDOM m) => GPUTextureDescriptor -> Word -> m ()
setUsage self val = liftDOM (void (self ^. jss "usage" (toJSVal val)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gputexturedescriptor-usage GPUTextureDescriptor.usage specification>
getUsage :: (MonadDOM m) => GPUTextureDescriptor -> m Word
getUsage self = liftDOM ((P.round <$> ((self ^. js "usage") >>= valToNumber)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gputexturedescriptor-viewformats GPUTextureDescriptor.viewFormats specification>
setViewFormats :: (MonadDOM m) => GPUTextureDescriptor -> [GPUTextureFormat] -> m ()
setViewFormats self val = liftDOM (void (self ^. jss "viewFormats" (toJSVal val)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gputexturedescriptor-viewformats GPUTextureDescriptor.viewFormats specification>
getViewFormats :: (MonadDOM m) => GPUTextureDescriptor -> m (Maybe [GPUTextureFormat])
getViewFormats self = liftDOM (((self ^. js "viewFormats") >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gputexturedescriptor-viewformats GPUTextureDescriptor.viewFormats specification>
getViewFormatsUnsafe :: (MonadDOM m, HasCallStack) => GPUTextureDescriptor -> m [GPUTextureFormat]
getViewFormatsUnsafe self = liftDOM ((((self ^. js "viewFormats") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://gpuweb.github.io/gpuweb/#dom-gputexturedescriptor-viewformats GPUTextureDescriptor.viewFormats specification>
getViewFormatsUnchecked :: (MonadDOM m) => GPUTextureDescriptor -> m [GPUTextureFormat]
getViewFormatsUnchecked self = liftDOM (((self ^. js "viewFormats") >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gputexturedescriptor-texturebindingviewdimension GPUTextureDescriptor.textureBindingViewDimension specification>
setTextureBindingViewDimension :: (MonadDOM m) => GPUTextureDescriptor -> GPUTextureViewDimension -> m ()
setTextureBindingViewDimension self val = liftDOM (void (self ^. jss "textureBindingViewDimension" (toJSVal val)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gputexturedescriptor-texturebindingviewdimension GPUTextureDescriptor.textureBindingViewDimension specification>
getTextureBindingViewDimension :: (MonadDOM m) => GPUTextureDescriptor -> m (Maybe GPUTextureViewDimension)
getTextureBindingViewDimension self = liftDOM (((self ^. js "textureBindingViewDimension") >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gputexturedescriptor-texturebindingviewdimension GPUTextureDescriptor.textureBindingViewDimension specification>
getTextureBindingViewDimensionUnsafe :: (MonadDOM m, HasCallStack) => GPUTextureDescriptor -> m GPUTextureViewDimension
getTextureBindingViewDimensionUnsafe self = liftDOM ((((self ^. js "textureBindingViewDimension") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://gpuweb.github.io/gpuweb/#dom-gputexturedescriptor-texturebindingviewdimension GPUTextureDescriptor.textureBindingViewDimension specification>
getTextureBindingViewDimensionUnchecked :: (MonadDOM m) => GPUTextureDescriptor -> m GPUTextureViewDimension
getTextureBindingViewDimensionUnchecked self = liftDOM (((self ^. js "textureBindingViewDimension") >>= fromJSValUnchecked))