Skip to content

Commit 94a3378

Browse files
author
Mike Solomon
committed
Adds view creation without descriptor
1 parent ed59897 commit 94a3378

9 files changed

Lines changed: 28 additions & 15 deletions

src/Web/GPU/GPUDevice.purs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ type GPUBindGroupLayoutDescriptor =
337337
foreign import createBindGroupLayoutImpl :: GPUDevice -> { | GPUBindGroupLayoutDescriptor } -> Effect GPUBindGroupLayout
338338

339339
createBindGroupLayout
340-
:: GPUDevice
340+
:: GPUDevice
341341
-> { | GPUBindGroupLayoutDescriptor }
342342
-> Effect GPUBindGroupLayout
343343
createBindGroupLayout = createBindGroupLayoutImpl
@@ -529,7 +529,7 @@ type GPUPipelineLayoutDescriptor =
529529
{ bindGroupLayouts :: Array GPUBindGroupLayout
530530
}
531531

532-
foreign import createPipelineLayoutImpl :: GPUDevice -> GPUPipelineLayoutDescriptor -> Effect GPUPipelineLayout
532+
foreign import createPipelineLayoutImpl :: GPUDevice -> GPUPipelineLayoutDescriptor -> Effect GPUPipelineLayout
533533

534534
createPipelineLayout
535535
:: GPUDevice
@@ -543,9 +543,9 @@ type GPUBindGroupDescriptor =
543543
, entries :: Array GPUBindGroupEntry
544544
}
545545

546-
foreign import createBindGroupImpl :: GPUDevice -> GPUBindGroupDescriptor -> Effect GPUBindGroup
546+
foreign import createBindGroupImpl :: GPUDevice -> GPUBindGroupDescriptor -> Effect GPUBindGroup
547547

548-
createBindGroup :: GPUDevice -> GPUBindGroupDescriptor -> Effect GPUBindGroup
548+
createBindGroup :: GPUDevice -> GPUBindGroupDescriptor -> Effect GPUBindGroup
549549
createBindGroup = createBindGroupImpl
550550

551551
-- createShaderModule

src/Web/GPU/GPUExternalTexture.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const expiredImpl = (texture) => () => texture.expired;
1+
export const expiredImpl = (texture) => () => texture.expired;

src/Web/GPU/GPUExternalTexture.purs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
module Web.GPU.GPUExternalTexture where
22

3-
4-
53
import Effect (Effect)
64
import Web.GPU.Internal.Types (GPUExternalTexture)
75

src/Web/GPU/GPUPipelineBase.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
export const unsafeGetBindGroupLayoutImpl = (pipeline) => (index) => () => pipeline.getBindGroupLayout(index);
1+
export const unsafeGetBindGroupLayoutImpl = (pipeline) => (index) => () =>
2+
pipeline.getBindGroupLayout(index);

src/Web/GPU/GPUPipelineBase.purs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ class GPUPipelineBase a where
1111

1212
instance GPUPipelineBase GPUComputePipeline where
1313
getBindGroupLayout = unsafeGetBindGroupLayoutImpl
14+
1415
instance GPUPipelineBase GPURenderPipeline where
1516
getBindGroupLayout = unsafeGetBindGroupLayoutImpl

src/Web/GPU/GPUShaderModule.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
export const compilationInfoImpl = (shaderModule) => () => shaderModule.compilationInfo();
1+
export const compilationInfoImpl = (shaderModule) => () =>
2+
shaderModule.compilationInfo();

src/Web/GPU/GPUTexture.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
export const createViewImpl = (texture) => (descriptor) => () => texture.createView(descriptor);
1+
export const createViewImpl = (texture) => () => texture.createView();
2+
export const createViewWithDescriptorImpl = (texture) => (descriptor) => () =>
3+
texture.createView(descriptor);
24
export const destroyImpl = (texture) => () => texture.destroy();
35
export const widthImpl = (texture) => () => texture.width;
46
export const heightImpl = (texture) => () => texture.height;
5-
export const depthOrArrayLayersImpl = (texture) => () => texture.depthOrArrayLayers;
7+
export const depthOrArrayLayersImpl = (texture) => () =>
8+
texture.depthOrArrayLayers;
69
export const mipLevelCountImpl = (texture) => () => texture.mipLevelCount;
710
export const sampleCountImpl = (texture) => () => texture.sampleCount;
811
export const dimensionImpl = (texture) => () => texture.dimension;
912
export const formatImpl = (texture) => () => texture.format;
10-
export const usageImpl = (texture) => () => texture.usage;
13+
export const usageImpl = (texture) => () => texture.usage;

src/Web/GPU/GPUTexture.purs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Web.GPU.GPUTexture
22
( TextureViewDescriptor
3+
, createViewWithDescriptor
34
, createView
45
, destroy
56
, width
@@ -57,19 +58,26 @@ instance ConvertOption TextureViewDescriptor "baseMipLevel" GPUIntegerCoordinate
5758
instance ConvertOption TextureViewDescriptor "baseArrayLayer" GPUIntegerCoordinate (Undefinable GPUIntegerCoordinate) where
5859
convertOption _ _ = defined
5960

60-
foreign import createViewImpl :: GPUTexture -> { | GPUTextureViewDescriptor } -> Effect GPUTextureView
61+
foreign import createViewWithDescriptorImpl :: GPUTexture -> { | GPUTextureViewDescriptor } -> Effect GPUTextureView
6162

62-
createView
63+
createViewWithDescriptor
6364
:: forall provided
6465
. ConvertOptionsWithDefaults TextureViewDescriptor { | GPUTextureViewDescriptorOptional } { | provided } { | GPUTextureViewDescriptor }
6566
=> GPUTexture
6667
-> { | provided }
6768
-> Effect GPUTextureView
68-
createView gpuDevice provided = createViewImpl gpuDevice all
69+
createViewWithDescriptor gpuDevice provided = createViewWithDescriptorImpl gpuDevice all
6970
where
7071
all :: { | GPUTextureViewDescriptor }
7172
all = convertOptionsWithDefaults TextureViewDescriptor defaultGPUTextureViewDescriptorOptions provided
7273

74+
foreign import createViewImpl :: GPUTexture -> Effect GPUTextureView
75+
76+
createView
77+
:: GPUTexture
78+
-> Effect GPUTextureView
79+
createView = createViewImpl
80+
7381
foreign import destroyImpl :: GPUTexture -> Effect Unit
7482

7583
destroy :: GPUTexture -> Effect Unit

src/Web/GPU/GPUTextureAspect.purs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ all = GPUTextureAspect "all"
1818

1919
stencilOnly :: GPUTextureAspect
2020
stencilOnly = GPUTextureAspect "stencil-only"
21+
2122
depthOnly :: GPUTextureAspect
2223
depthOnly = GPUTextureAspect "depth-only"

0 commit comments

Comments
 (0)