q5 4.7.4 → 4.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/deno.json +1 -1
  2. package/package.json +1 -1
  3. package/q5.js +10 -8
package/deno.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@q5/q5",
3
- "version": "4.7.0",
3
+ "version": "4.7.5",
4
4
  "license": "LGPL-3.0-only",
5
5
  "description": "Beginner friendly graphics powered by WebGPU, optimized for interactive art!",
6
6
  "author": "quinton-ashley",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q5",
3
- "version": "4.7.4",
3
+ "version": "4.7.5",
4
4
  "description": "Beginner friendly graphics powered by WebGPU, optimized for interactive art!",
5
5
  "author": "quinton-ashley",
6
6
  "license": "LGPL-3.0-only",
package/q5.js CHANGED
@@ -5420,6 +5420,8 @@ Q5.renderers.webgpu.canvas = ($, q) => {
5420
5420
 
5421
5421
  if ($.colorMode) $.colorMode('rgb', 1);
5422
5422
 
5423
+ const CANVAS_FORMAT = navigator.gpu.getPreferredCanvasFormat();
5424
+
5423
5425
  $._baseShaderCode = /* wgsl */ `
5424
5426
  struct Q5 {
5425
5427
  width: f32,
@@ -6608,7 +6610,7 @@ fn fragMain(f: FragParams) -> @location(0) vec4f {
6608
6610
  fragment: {
6609
6611
  module: shapesShader,
6610
6612
  entryPoint: 'fragMain',
6611
- targets: [{ format: 'bgra8unorm', blend: $.blendConfigs['source-over'] }]
6613
+ targets: [{ format: CANVAS_FORMAT, blend: $.blendConfigs['source-over'] }]
6612
6614
  },
6613
6615
  primitive: { topology: 'triangle-strip', stripIndexFormat: 'uint32' },
6614
6616
  multisample: { count: 4 }
@@ -7170,7 +7172,7 @@ fn vertexMain(v: VertexParams) -> FragParams {
7170
7172
  entryPoint: 'fragMain',
7171
7173
  targets: [
7172
7174
  {
7173
- format: 'bgra8unorm',
7175
+ format: CANVAS_FORMAT,
7174
7176
  blend: $.blendConfigs['source-over']
7175
7177
  }
7176
7178
  ]
@@ -7532,7 +7534,7 @@ fn fragMain(f: FragParams) -> @location(0) vec4f {
7532
7534
  entryPoint: 'fragMain',
7533
7535
  targets: [
7534
7536
  {
7535
- format: 'bgra8unorm',
7537
+ format: CANVAS_FORMAT,
7536
7538
  blend: $.blendConfigs['source-over']
7537
7539
  }
7538
7540
  ]
@@ -7805,7 +7807,7 @@ fn fragMain(f: FragParams) -> @location(0) vec4f {
7805
7807
  fragment: {
7806
7808
  module: imageShader,
7807
7809
  entryPoint: 'fragMain',
7808
- targets: [{ format: 'bgra8unorm', blend: $.blendConfigs['source-over'] }]
7810
+ targets: [{ format: CANVAS_FORMAT, blend: $.blendConfigs['source-over'] }]
7809
7811
  },
7810
7812
  primitive: { topology: 'triangle-strip', stripIndexFormat: 'uint32' },
7811
7813
  multisample: { count: 4 }
@@ -7824,7 +7826,7 @@ fn fragMain(f: FragParams) -> @location(0) vec4f {
7824
7826
  fragment: {
7825
7827
  module: videoShader,
7826
7828
  entryPoint: 'fragMain',
7827
- targets: [{ format: 'bgra8unorm', blend: $.blendConfigs['source-over'] }]
7829
+ targets: [{ format: CANVAS_FORMAT, blend: $.blendConfigs['source-over'] }]
7828
7830
  },
7829
7831
  primitive: { topology: 'triangle-strip', stripIndexFormat: 'uint32' },
7830
7832
  multisample: { count: 4 }
@@ -7922,7 +7924,7 @@ fn fragMain(f: FragParams) -> @location(0) vec4f {
7922
7924
 
7923
7925
  texture = Q5.device.createTexture({
7924
7926
  size: textureSize,
7925
- format: 'bgra8unorm',
7927
+ format: CANVAS_FORMAT,
7926
7928
  usage:
7927
7929
  GPUTextureUsage.TEXTURE_BINDING |
7928
7930
  GPUTextureUsage.COPY_SRC |
@@ -8294,7 +8296,7 @@ fn fragMain(f : FragParams) -> @location(0) vec4f {
8294
8296
  fragment: {
8295
8297
  module: textShader,
8296
8298
  entryPoint: 'fragMain',
8297
- targets: [{ format: 'bgra8unorm', blend: $.blendConfigs['source-over'] }]
8299
+ targets: [{ format: CANVAS_FORMAT, blend: $.blendConfigs['source-over'] }]
8298
8300
  },
8299
8301
  primitive: { topology: 'triangle-strip', stripIndexFormat: 'uint32' },
8300
8302
  multisample: { count: 4 }
@@ -8858,7 +8860,7 @@ fn fragMain(f : FragParams) -> @location(0) vec4f {
8858
8860
  entryPoint: 'fragMain',
8859
8861
  targets: [
8860
8862
  {
8861
- format: 'bgra8unorm',
8863
+ format: CANVAS_FORMAT,
8862
8864
  blend: $.blendConfigs[blend]
8863
8865
  }
8864
8866
  ]