Skip to content

Commit

Permalink
Removing a bunch of stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
iwoplaza committed Nov 15, 2024
1 parent d5020ad commit 926353c
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 242 deletions.
51 changes: 0 additions & 51 deletions packages/typegpu/src/builtinIdentifiers.ts

This file was deleted.

20 changes: 19 additions & 1 deletion packages/typegpu/src/data/attributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
type Parsed,
type Unwrap,
} from 'typed-binary';
import type { BuiltinName } from '../builtinIdentifiers';
import { RecursiveDataTypeError } from '../errors';
import {
type AnyTgpuData,
Expand All @@ -26,6 +25,25 @@ import alignIO from './alignIO';
// Public API
// ----------

export const builtinNames = [
'vertex_index',
'instance_index',
'position',
'clip_distances',
'front_facing',
'frag_depth',
'sample_index',
'sample_mask',
'fragment',
'local_invocation_id',
'local_invocation_index',
'global_invocation_id',
'workgroup_id',
'num_workgroups',
] as const;

export type BuiltinName = (typeof builtinNames)[number];

export interface Align<T extends number> {
type: 'align';
alignment: T;
Expand Down
5 changes: 0 additions & 5 deletions packages/typegpu/src/macro/index.ts

This file was deleted.

45 changes: 0 additions & 45 deletions packages/typegpu/src/macro/repeat.ts

This file was deleted.

4 changes: 0 additions & 4 deletions packages/typegpu/src/tgpuCode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { idForBuiltin } from './builtinIdentifiers';
import {
type BoundTgpuCode,
type Eventual,
Expand Down Expand Up @@ -58,9 +57,6 @@ class TgpuCodeImpl implements TgpuCode {
} else if (typeof s === 'function') {
const result = s((eventual) => ctx.unwrap(eventual));
code += ctx.resolve(result);
} else if (typeof s === 'symbol') {
ctx.addBuiltin(s);
code += ctx.resolve(idForBuiltin(s));
} else {
code += String(s);
}
Expand Down
37 changes: 0 additions & 37 deletions packages/typegpu/src/tgpuIdentifier.ts

This file was deleted.

62 changes: 0 additions & 62 deletions packages/typegpu/tests/macro.test.ts

This file was deleted.

41 changes: 4 additions & 37 deletions packages/typegpu/tests/runtime.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, it, vi } from 'vitest';
import { afterEach } from 'vitest';
import { struct, u32, vec3i, vec4u } from '../src/data';
import tgpu, { asReadonly, asUniform, wgsl } from '../src/experimental';
import tgpu from '../src/experimental';
import { plum } from '../src/tgpuPlum';
import './utils/webgpuGlobals';

Expand Down Expand Up @@ -67,17 +67,11 @@ describe('TgpuRoot', () => {
device: mockDevice as unknown as GPUDevice,
});
const dataBuffer = root.createBuffer(u32).$usage('uniform');
const data = asUniform(dataBuffer);

const testPipeline = root.makeComputePipeline({
code: wgsl`${data}`,
});

const mockBuffer = root.unwrap(dataBuffer);
expect(mockBuffer).toBeDefined();
expect(mockBuffer.getMappedRange).not.toBeCalled();

expect(testPipeline).toBeDefined();
expect(root.device.createBuffer).toBeCalledWith({
mappedAtCreation: false,
size: 4,
Expand All @@ -95,17 +89,11 @@ describe('TgpuRoot', () => {
const dataBuffer = root
.createBuffer(vec3i, vec3i(0, 0, 0))
.$usage('uniform');
const data = asUniform(dataBuffer);

const testPipeline = root.makeComputePipeline({
code: wgsl`${data}`,
});

const mockBuffer = root.unwrap(dataBuffer);
expect(mockBuffer).toBeDefined();
expect(mockBuffer.getMappedRange).toBeCalled();

expect(testPipeline).toBeDefined();
expect(root.device.createBuffer).toBeCalledWith({
mappedAtCreation: true,
size: 12,
Expand All @@ -123,15 +111,8 @@ describe('TgpuRoot', () => {
const s1 = struct({ a: u32, b: u32 });
const s2 = struct({ a: u32, b: s1 });
const dataBuffer = root.createBuffer(s2).$usage('uniform');
const data = asUniform(dataBuffer);

const testPipeline = root.makeComputePipeline({
code: wgsl`${data}`,
});

testPipeline.execute();

expect(testPipeline).toBeDefined();
root.unwrap(dataBuffer);
expect(root.device.createBuffer).toBeCalledWith({
mappedAtCreation: false,
size: 12,
Expand Down Expand Up @@ -171,15 +152,8 @@ describe('TgpuRoot', () => {
const s2 = struct({ a: u32, b: s1, c: vec4u });

const dataBuffer = root.createBuffer(s2).$usage('uniform');
const data = asUniform(dataBuffer);

const testPipeline = root.makeComputePipeline({
code: wgsl`let x = ${data};`,
});

testPipeline.execute();

expect(testPipeline).toBeDefined();
root.unwrap(dataBuffer);
expect(root.device.createBuffer).toBeCalledWith({
mappedAtCreation: false,
size: 64,
Expand Down Expand Up @@ -216,16 +190,9 @@ describe('TgpuRoot', () => {
const dataBuffer = root.createBuffer(u32, intPlum).$usage('storage');
const spy = vi.spyOn(dataBuffer, 'write');

const buffer = asReadonly(dataBuffer);

const testPipeline = root.makeComputePipeline({
code: wgsl`${buffer}`,
});

testPipeline.execute();
root.unwrap(dataBuffer);

expect(spy).toBeCalledTimes(0);
expect(testPipeline).toBeDefined();
expect(root.device.createBuffer).toBeCalledWith({
mappedAtCreation: true,
size: 4,
Expand Down

0 comments on commit 926353c

Please sign in to comment.