for (let setter of BuiltinMatrixSetter.functions())
this._map.set(setter.toString(), func => setter.instantiateImplementation(func));
- for (let addressSpace of ["thread", "threadgroup", "device"]) {
- this._map.set(
- `native void InterlockedAdd(atomic_uint* ${addressSpace},uint,uint* thread)`,
- func => {
- func.implementation = function([atomic, value, originalValue]) {
- if (!atomic.loadValue())
- throw new WTrapError("[Atomics]", "Null atomic pointer");
- let a = atomic.loadValue().loadValue();
- let b = value.loadValue();
- let result = castToUint(a + b);
- if (originalValue.loadValue())
- originalValue.loadValue().copyFrom(EPtr.box(a), 1);
- atomic.loadValue().copyFrom(EPtr.box(result), 1);
- }
- });
+ for (let addressSpace1 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace2 of ["thread", "threadgroup", "device"]) {
+ this._map.set(
+ `native void InterlockedAdd(atomic_uint* ${addressSpace1},uint,uint* ${addressSpace2})`,
+ func => {
+ func.implementation = function([atomic, value, originalValue], node) {
+ if (!atomic.loadValue())
+ throw new WTrapError(node.origin.originString, "Null atomic pointer");
+ let a = atomic.loadValue().loadValue();
+ let b = value.loadValue();
+ let result = castToUint(a + b);
+ if (originalValue.loadValue())
+ originalValue.loadValue().copyFrom(EPtr.box(a), 1);
+ atomic.loadValue().copyFrom(EPtr.box(result), 1);
+ }
+ });
- this._map.set(
- `native void InterlockedAdd(atomic_int* ${addressSpace},int,int* thread)`,
- func => {
- func.implementation = function([atomic, value, originalValue]) {
- if (!atomic.loadValue())
- throw new WTrapError("[Atomics]", "Null atomic pointer");
- let a = atomic.loadValue().loadValue();
- let b = value.loadValue();
- let result = castToInt(a + b);
- if (originalValue.loadValue())
- originalValue.loadValue().copyFrom(EPtr.box(a), 1);
- atomic.loadValue().copyFrom(EPtr.box(result), 1);
- }
- });
+ this._map.set(
+ `native void InterlockedAdd(atomic_int* ${addressSpace1},int,int* ${addressSpace2})`,
+ func => {
+ func.implementation = function([atomic, value, originalValue], node) {
+ if (!atomic.loadValue())
+ throw new WTrapError(node.origin.originString, "Null atomic pointer");
+ let a = atomic.loadValue().loadValue();
+ let b = value.loadValue();
+ let result = castToInt(a + b);
+ if (originalValue.loadValue())
+ originalValue.loadValue().copyFrom(EPtr.box(a), 1);
+ atomic.loadValue().copyFrom(EPtr.box(result), 1);
+ }
+ });
- this._map.set(
- `native void InterlockedAnd(atomic_uint* ${addressSpace},uint,uint* thread)`,
- func => {
- func.implementation = function([atomic, value, originalValue]) {
- if (!atomic.loadValue())
- throw new WTrapError("[Atomics]", "Null atomic pointer");
- let a = atomic.loadValue().loadValue();
- let b = value.loadValue();
- let result = castToUint(a & b);
- if (originalValue.loadValue())
- originalValue.loadValue().copyFrom(EPtr.box(a), 1);
- atomic.loadValue().copyFrom(EPtr.box(result), 1);
- }
- });
+ this._map.set(
+ `native void InterlockedAnd(atomic_uint* ${addressSpace1},uint,uint* ${addressSpace2})`,
+ func => {
+ func.implementation = function([atomic, value, originalValue], node) {
+ if (!atomic.loadValue())
+ throw new WTrapError(node.origin.originString, "Null atomic pointer");
+ let a = atomic.loadValue().loadValue();
+ let b = value.loadValue();
+ let result = castToUint(a & b);
+ if (originalValue.loadValue())
+ originalValue.loadValue().copyFrom(EPtr.box(a), 1);
+ atomic.loadValue().copyFrom(EPtr.box(result), 1);
+ }
+ });
- this._map.set(
- `native void InterlockedAnd(atomic_int* ${addressSpace},int,int* thread)`,
- func => {
- func.implementation = function([atomic, value, originalValue]) {
- if (!atomic.loadValue())
- throw new WTrapError("[Atomics]", "Null atomic pointer");
- let a = atomic.loadValue().loadValue();
- let b = value.loadValue();
- let result = castToInt(a & b);
- if (originalValue.loadValue())
- originalValue.loadValue().copyFrom(EPtr.box(a), 1);
- atomic.loadValue().copyFrom(EPtr.box(result), 1);
- }
- });
+ this._map.set(
+ `native void InterlockedAnd(atomic_int* ${addressSpace1},int,int* ${addressSpace2})`,
+ func => {
+ func.implementation = function([atomic, value, originalValue], node) {
+ if (!atomic.loadValue())
+ throw new WTrapError(node.origin.originString, "Null atomic pointer");
+ let a = atomic.loadValue().loadValue();
+ let b = value.loadValue();
+ let result = castToInt(a & b);
+ if (originalValue.loadValue())
+ originalValue.loadValue().copyFrom(EPtr.box(a), 1);
+ atomic.loadValue().copyFrom(EPtr.box(result), 1);
+ }
+ });
- this._map.set(
- `native void InterlockedExchange(atomic_uint* ${addressSpace},uint,uint* thread)`,
- func => {
- func.implementation = function([atomic, value, originalValue]) {
- if (!atomic.loadValue())
- throw new WTrapError("[Atomics]", "Null atomic pointer");
- let a = atomic.loadValue().loadValue();
- let b = value.loadValue();
- if (originalValue.loadValue())
- originalValue.loadValue().copyFrom(EPtr.box(a), 1);
- atomic.loadValue().copyFrom(EPtr.box(b), 1);
- }
- });
+ this._map.set(
+ `native void InterlockedExchange(atomic_uint* ${addressSpace1},uint,uint* ${addressSpace2})`,
+ func => {
+ func.implementation = function([atomic, value, originalValue], node) {
+ if (!atomic.loadValue())
+ throw new WTrapError(node.origin.originString, "Null atomic pointer");
+ let a = atomic.loadValue().loadValue();
+ let b = value.loadValue();
+ if (originalValue.loadValue())
+ originalValue.loadValue().copyFrom(EPtr.box(a), 1);
+ atomic.loadValue().copyFrom(EPtr.box(b), 1);
+ }
+ });
- this._map.set(
- `native void InterlockedExchange(atomic_int* ${addressSpace},int,int* thread)`,
- func => {
- func.implementation = function([atomic, value, originalValue]) {
- if (!atomic.loadValue())
- throw new WTrapError("[Atomics]", "Null atomic pointer");
- let a = atomic.loadValue().loadValue();
- let b = value.loadValue();
- if (originalValue.loadValue())
- originalValue.loadValue().copyFrom(EPtr.box(a), 1);
- atomic.loadValue().copyFrom(EPtr.box(b), 1);
- }
- });
+ this._map.set(
+ `native void InterlockedExchange(atomic_int* ${addressSpace1},int,int* ${addressSpace2})`,
+ func => {
+ func.implementation = function([atomic, value, originalValue], node) {
+ if (!atomic.loadValue())
+ throw new WTrapError(node.origin.originString, "Null atomic pointer");
+ let a = atomic.loadValue().loadValue();
+ let b = value.loadValue();
+ if (originalValue.loadValue())
+ originalValue.loadValue().copyFrom(EPtr.box(a), 1);
+ atomic.loadValue().copyFrom(EPtr.box(b), 1);
+ }
+ });
- this._map.set(
- `native void InterlockedMax(atomic_uint* ${addressSpace},uint,uint* thread)`,
- func => {
- func.implementation = function([atomic, value, originalValue]) {
- if (!atomic.loadValue())
- throw new WTrapError("[Atomics]", "Null atomic pointer");
- let a = atomic.loadValue().loadValue();
- let b = value.loadValue();
- let result = castToUint(a > b ? a : b);
- if (originalValue.loadValue())
- originalValue.loadValue().copyFrom(EPtr.box(a), 1);
- atomic.loadValue().copyFrom(EPtr.box(result), 1);
- }
- });
+ this._map.set(
+ `native void InterlockedMax(atomic_uint* ${addressSpace1},uint,uint* ${addressSpace2})`,
+ func => {
+ func.implementation = function([atomic, value, originalValue], node) {
+ if (!atomic.loadValue())
+ throw new WTrapError(node.origin.originString, "Null atomic pointer");
+ let a = atomic.loadValue().loadValue();
+ let b = value.loadValue();
+ let result = castToUint(a > b ? a : b);
+ if (originalValue.loadValue())
+ originalValue.loadValue().copyFrom(EPtr.box(a), 1);
+ atomic.loadValue().copyFrom(EPtr.box(result), 1);
+ }
+ });
- this._map.set(
- `native void InterlockedMax(atomic_int* ${addressSpace},int,int* thread)`,
- func => {
- func.implementation = function([atomic, value, originalValue]) {
- if (!atomic.loadValue())
- throw new WTrapError("[Atomics]", "Null atomic pointer");
- let a = atomic.loadValue().loadValue();
- let b = value.loadValue();
- let result = castToInt(a > b ? a : b);
- if (originalValue.loadValue())
- originalValue.loadValue().copyFrom(EPtr.box(a), 1);
- atomic.loadValue().copyFrom(EPtr.box(result), 1);
- }
- });
+ this._map.set(
+ `native void InterlockedMax(atomic_int* ${addressSpace1},int,int* ${addressSpace2})`,
+ func => {
+ func.implementation = function([atomic, value, originalValue], node) {
+ if (!atomic.loadValue())
+ throw new WTrapError(node.origin.originString, "Null atomic pointer");
+ let a = atomic.loadValue().loadValue();
+ let b = value.loadValue();
+ let result = castToInt(a > b ? a : b);
+ if (originalValue.loadValue())
+ originalValue.loadValue().copyFrom(EPtr.box(a), 1);
+ atomic.loadValue().copyFrom(EPtr.box(result), 1);
+ }
+ });
- this._map.set(
- `native void InterlockedMin(atomic_uint* ${addressSpace},uint,uint* thread)`,
- func => {
- func.implementation = function([atomic, value, originalValue]) {
- if (!atomic.loadValue())
- throw new WTrapError("[Atomics]", "Null atomic pointer");
- let a = atomic.loadValue().loadValue();
- let b = value.loadValue();
- let result = castToUint(a < b ? a : b);
- if (originalValue.loadValue())
- originalValue.loadValue().copyFrom(EPtr.box(a), 1);
- atomic.loadValue().copyFrom(EPtr.box(result), 1);
- }
- });
+ this._map.set(
+ `native void InterlockedMin(atomic_uint* ${addressSpace1},uint,uint* ${addressSpace2})`,
+ func => {
+ func.implementation = function([atomic, value, originalValue], node) {
+ if (!atomic.loadValue())
+ throw new WTrapError(node.origin.originString, "Null atomic pointer");
+ let a = atomic.loadValue().loadValue();
+ let b = value.loadValue();
+ let result = castToUint(a < b ? a : b);
+ if (originalValue.loadValue())
+ originalValue.loadValue().copyFrom(EPtr.box(a), 1);
+ atomic.loadValue().copyFrom(EPtr.box(result), 1);
+ }
+ });
- this._map.set(
- `native void InterlockedMin(atomic_int* ${addressSpace},int,int* thread)`,
- func => {
- func.implementation = function([atomic, value, originalValue]) {
- if (!atomic.loadValue())
- throw new WTrapError("[Atomics]", "Null atomic pointer");
- let a = atomic.loadValue().loadValue();
- let b = value.loadValue();
- let result = castToInt(a < b ? a : b);
- if (originalValue.loadValue())
- originalValue.loadValue().copyFrom(EPtr.box(a), 1);
- atomic.loadValue().copyFrom(EPtr.box(result), 1);
- }
- });
+ this._map.set(
+ `native void InterlockedMin(atomic_int* ${addressSpace1},int,int* ${addressSpace2})`,
+ func => {
+ func.implementation = function([atomic, value, originalValue], node) {
+ if (!atomic.loadValue())
+ throw new WTrapError(node.origin.originString, "Null atomic pointer");
+ let a = atomic.loadValue().loadValue();
+ let b = value.loadValue();
+ let result = castToInt(a < b ? a : b);
+ if (originalValue.loadValue())
+ originalValue.loadValue().copyFrom(EPtr.box(a), 1);
+ atomic.loadValue().copyFrom(EPtr.box(result), 1);
+ }
+ });
- this._map.set(
- `native void InterlockedOr(atomic_uint* ${addressSpace},uint,uint* thread)`,
- func => {
- func.implementation = function([atomic, value, originalValue]) {
- if (!atomic.loadValue())
- throw new WTrapError("[Atomics]", "Null atomic pointer");
- let a = atomic.loadValue().loadValue();
- let b = value.loadValue();
- let result = castToUint(a | b);
- if (originalValue.loadValue())
- originalValue.loadValue().copyFrom(EPtr.box(a), 1);
- atomic.loadValue().copyFrom(EPtr.box(result), 1);
- }
- });
+ this._map.set(
+ `native void InterlockedOr(atomic_uint* ${addressSpace1},uint,uint* ${addressSpace2})`,
+ func => {
+ func.implementation = function([atomic, value, originalValue], node) {
+ if (!atomic.loadValue())
+ throw new WTrapError(node.origin.originString, "Null atomic pointer");
+ let a = atomic.loadValue().loadValue();
+ let b = value.loadValue();
+ let result = castToUint(a | b);
+ if (originalValue.loadValue())
+ originalValue.loadValue().copyFrom(EPtr.box(a), 1);
+ atomic.loadValue().copyFrom(EPtr.box(result), 1);
+ }
+ });
- this._map.set(
- `native void InterlockedOr(atomic_int* ${addressSpace},int,int* thread)`,
- func => {
- func.implementation = function([atomic, value, originalValue]) {
- if (!atomic.loadValue())
- throw new WTrapError("[Atomics]", "Null atomic pointer");
- let a = atomic.loadValue().loadValue();
- let b = value.loadValue();
- let result = castToInt(a | b);
- if (originalValue.loadValue())
- originalValue.loadValue().copyFrom(EPtr.box(a), 1);
- atomic.loadValue().copyFrom(EPtr.box(result), 1);
- }
- });
+ this._map.set(
+ `native void InterlockedOr(atomic_int* ${addressSpace1},int,int* ${addressSpace2})`,
+ func => {
+ func.implementation = function([atomic, value, originalValue], node) {
+ if (!atomic.loadValue())
+ throw new WTrapError(node.origin.originString, "Null atomic pointer");
+ let a = atomic.loadValue().loadValue();
+ let b = value.loadValue();
+ let result = castToInt(a | b);
+ if (originalValue.loadValue())
+ originalValue.loadValue().copyFrom(EPtr.box(a), 1);
+ atomic.loadValue().copyFrom(EPtr.box(result), 1);
+ }
+ });
- this._map.set(
- `native void InterlockedXor(atomic_uint* ${addressSpace},uint,uint* thread)`,
- func => {
- func.implementation = function([atomic, value, originalValue]) {
- if (!atomic.loadValue())
- throw new WTrapError("[Atomics]", "Null atomic pointer");
- let a = atomic.loadValue().loadValue();
- let b = value.loadValue();
- let result = castToUint(a ^ b);
- if (originalValue.loadValue())
- originalValue.loadValue().copyFrom(EPtr.box(a), 1);
- atomic.loadValue().copyFrom(EPtr.box(result), 1);
- }
- });
+ this._map.set(
+ `native void InterlockedXor(atomic_uint* ${addressSpace1},uint,uint* ${addressSpace2})`,
+ func => {
+ func.implementation = function([atomic, value, originalValue], node) {
+ if (!atomic.loadValue())
+ throw new WTrapError(node.origin.originString, "Null atomic pointer");
+ let a = atomic.loadValue().loadValue();
+ let b = value.loadValue();
+ let result = castToUint(a ^ b);
+ if (originalValue.loadValue())
+ originalValue.loadValue().copyFrom(EPtr.box(a), 1);
+ atomic.loadValue().copyFrom(EPtr.box(result), 1);
+ }
+ });
- this._map.set(
- `native void InterlockedXor(atomic_int* ${addressSpace},int,int* thread)`,
- func => {
- func.implementation = function([atomic, value, originalValue]) {
- if (!atomic.loadValue())
- throw new WTrapError("[Atomics]", "Null atomic pointer");
- let a = atomic.loadValue().loadValue();
- let b = value.loadValue();
- let result = castToInt(a ^ b);
- if (originalValue.loadValue())
- originalValue.loadValue().copyFrom(EPtr.box(a), 1);
- atomic.loadValue().copyFrom(EPtr.box(result), 1);
- }
- });
+ this._map.set(
+ `native void InterlockedXor(atomic_int* ${addressSpace1},int,int* ${addressSpace2})`,
+ func => {
+ func.implementation = function([atomic, value, originalValue], node) {
+ if (!atomic.loadValue())
+ throw new WTrapError(node.origin.originString, "Null atomic pointer");
+ let a = atomic.loadValue().loadValue();
+ let b = value.loadValue();
+ let result = castToInt(a ^ b);
+ if (originalValue.loadValue())
+ originalValue.loadValue().copyFrom(EPtr.box(a), 1);
+ atomic.loadValue().copyFrom(EPtr.box(result), 1);
+ }
+ });
- this._map.set(
- `native void InterlockedCompareExchange(atomic_uint* ${addressSpace},uint,uint,uint* thread)`,
- func => {
- func.implementation = function([atomic, compareValue, value, originalValue]) {
- if (!atomic.loadValue())
- throw new WTrapError("[Atomics]", "Null atomic pointer");
- let a = atomic.loadValue().loadValue();
- let b = compareValue.loadValue();
- let c = value.loadValue();
- if (a == b)
- atomic.loadValue().copyFrom(EPtr.box(c), 1);
- if (originalValue.loadValue())
- originalValue.loadValue().copyFrom(EPtr.box(a), 1);
- }
- });
+ this._map.set(
+ `native void InterlockedCompareExchange(atomic_uint* ${addressSpace1},uint,uint,uint* ${addressSpace2})`,
+ func => {
+ func.implementation = function([atomic, compareValue, value, originalValue]) {
+ if (!atomic.loadValue())
+ throw new WTrapError(node.origin.originString, "Null atomic pointer");
+ let a = atomic.loadValue().loadValue();
+ let b = compareValue.loadValue();
+ let c = value.loadValue();
+ if (a == b)
+ atomic.loadValue().copyFrom(EPtr.box(c), 1);
+ if (originalValue.loadValue())
+ originalValue.loadValue().copyFrom(EPtr.box(a), 1);
+ }
+ });
- this._map.set(
- `native void InterlockedCompareExchange(atomic_int* ${addressSpace},int,int,int* thread)`,
- func => {
- func.implementation = function([atomic, compareValue, value, originalValue]) {
- if (!atomic.loadValue())
- throw new WTrapError("[Atomics]", "Null atomic pointer");
- let a = atomic.loadValue().loadValue();
- let b = compareValue.loadValue();
- let c = value.loadValue();
- if (a == b)
- atomic.loadValue().copyFrom(EPtr.box(c), 1);
- if (originalValue.loadValue())
- originalValue.loadValue().copyFrom(EPtr.box(a), 1);
- }
- });
+ this._map.set(
+ `native void InterlockedCompareExchange(atomic_int* ${addressSpace1},int,int,int* ${addressSpace2})`,
+ func => {
+ func.implementation = function([atomic, compareValue, value, originalValue]) {
+ if (!atomic.loadValue())
+ throw new WTrapError(node.origin.originString, "Null atomic pointer");
+ let a = atomic.loadValue().loadValue();
+ let b = compareValue.loadValue();
+ let c = value.loadValue();
+ if (a == b)
+ atomic.loadValue().copyFrom(EPtr.box(c), 1);
+ if (originalValue.loadValue())
+ originalValue.loadValue().copyFrom(EPtr.box(a), 1);
+ }
+ });
+ }
}
function checkUndefined(origin, explanation, value)
{
if (value == undefined)
- throw new WTrapError("[Load]", "Texture read out of bounds");
+ throw new WTrapError(origin, "Texture read out of bounds");
return value;
}
function checkFalse(origin, explanation, value)
{
if (value == false)
- throw new WTrapError("[Store]", "Texture store out of bounds");
+ throw new WTrapError(origin, "Texture store out of bounds");
}
function boxVector(a)
this._map.set(
`native ${type}${length} Load(Texture1D<${type}${length}>,int2 location)`,
func => {
- func.implementation = function ([texture, location]) {
- return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(0, location.get(1), 0, 0, location.get(0))));
+ func.implementation = function ([texture, location], node) {
+ return boxVector(checkUndefined(node.origin.originString, "Texture read out of bounds", texture.loadValue().elementChecked(0, location.get(1), 0, 0, location.get(0))));
}
});
this._map.set(
`native ${type}${length} Load(Texture1D<${type}${length}>,int2 location,int offset)`,
func => {
- func.implementation = function ([texture, location, offset]) {
- return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(0, location.get(1), 0, 0, location.get(0) + offset.loadValue())));
- }
- });
- this._map.set(
- `native void GetDimensions(Texture1D<${type}${length}>,uint MipLevel,uint* thread Width,uint* thread NumberOfLevels)`,
- func => {
- func.implementation = function([texture, miplevel, width, numberOfLevels]) {
- let tex = texture.loadValue();
- let mipID = miplevel.loadValue();
- if (mipID >= tex.levelCount)
- throw new WTrapError("[GetDimensions]", "Reading from nonexistant mip level of texture");
- if (width.loadValue())
- width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1);
- if (numberOfLevels.loadValue())
- numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1);
+ func.implementation = function ([texture, location, offset], node) {
+ return boxVector(checkUndefined(node.origin.originString, "Texture read out of bounds", texture.loadValue().elementChecked(0, location.get(1), 0, 0, location.get(0) + offset.loadValue())));
}
});
+ for (let addressSpace1 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace2 of ["thread", "threadgroup", "device"]) {
+ this._map.set(
+ `native void GetDimensions(Texture1D<${type}${length}>,uint MipLevel,uint* ${addressSpace1} Width,uint* ${addressSpace2} NumberOfLevels)`,
+ func => {
+ func.implementation = function([texture, miplevel, width, numberOfLevels], node) {
+ let tex = texture.loadValue();
+ let mipID = miplevel.loadValue();
+ if (mipID >= tex.levelCount)
+ throw new WTrapError(node.origin.originString, "Reading from nonexistant mip level of texture");
+ if (width.loadValue())
+ width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1);
+ if (numberOfLevels.loadValue())
+ numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1);
+ }
+ });
+ }
+ }
- this._map.set(
+ this._map.set(
`native ${type}${length} Sample(Texture1DArray<${type}${length}>,sampler,float2 location)`,
func => {
func.implementation = function([texture, sampler, location]) {
this._map.set(
`native ${type}${length} Load(Texture1DArray<${type}${length}>,int3 location)`,
func => {
- func.implementation = function ([texture, location]) {
- return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(location.get(2), location.get(1), 0, 0, location.get(0))));
+ func.implementation = function ([texture, location], node) {
+ return boxVector(checkUndefined(node.origin.originString, "Texture read out of bounds", texture.loadValue().elementChecked(location.get(2), location.get(1), 0, 0, location.get(0))));
}
});
this._map.set(
`native ${type}${length} Load(Texture1DArray<${type}${length}>,int3 location,int offset)`,
func => {
- func.implementation = function ([texture, location, offset]) {
- return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(location.get(2), location.get(1), 0, 0, location.get(0) + offset.loadValue())));
+ func.implementation = function ([texture, location, offset], node) {
+ return boxVector(checkUndefined(node.origin.originString, "Texture read out of bounds", texture.loadValue().elementChecked(location.get(2), location.get(1), 0, 0, location.get(0) + offset.loadValue())));
}
});
- this._map.set(
- `native void GetDimensions(Texture1DArray<${type}${length}>,uint MipLevel,uint* thread Width,uint* thread Elements,uint* thread NumberOfLevels)`,
- func => {
- func.implementation = function([texture, miplevel, width, elements, numberOfLevels]) {
- let tex = texture.loadValue();
- let mipID = miplevel.loadValue();
- if (mipID >= tex.levelCount)
- throw new WTrapError("[GetDimensions]", "Reading from nonexistant mip level of texture");
- if (width.loadValue())
- width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1);
- if (elements.loadValue())
- elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1);
- if (numberOfLevels.loadValue())
- numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1);
+ for (let addressSpace1 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace2 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace3 of ["thread", "threadgroup", "device"]) {
+ this._map.set(
+ `native void GetDimensions(Texture1DArray<${type}${length}>,uint MipLevel,uint* ${addressSpace1} Width,uint* ${addressSpace2} Elements,uint* ${addressSpace3} NumberOfLevels)`,
+ func => {
+ func.implementation = function([texture, miplevel, width, elements, numberOfLevels], node) {
+ let tex = texture.loadValue();
+ let mipID = miplevel.loadValue();
+ if (mipID >= tex.levelCount)
+ throw new WTrapError(node.origin.originString, "Reading from nonexistant mip level of texture");
+ if (width.loadValue())
+ width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1);
+ if (elements.loadValue())
+ elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1);
+ if (numberOfLevels.loadValue())
+ numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1);
+ }
+ });
}
- });
+ }
+ }
- this._map.set(
+ this._map.set(
`native ${type}${length} Sample(Texture2D<${type}${length}>,sampler,float2 location)`,
func => {
func.implementation = function([texture, sampler, location]) {
this._map.set(
`native ${type}${length} Load(Texture2D<${type}${length}>,int3 location)`,
func => {
- func.implementation = function ([texture, location]) {
- return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(0, location.get(2), 0, location.get(1), location.get(0))));
+ func.implementation = function ([texture, location], node) {
+ return boxVector(checkUndefined(node.origin.originString, "Texture read out of bounds", texture.loadValue().elementChecked(0, location.get(2), 0, location.get(1), location.get(0))));
}
});
this._map.set(
`native ${type}${length} Load(Texture2D<${type}${length}>,int3 location,int2 offset)`,
func => {
- func.implementation = function ([texture, location, offset]) {
- return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(0, location.get(2), 0, location.get(1) + offset.get(1), location.get(0) + offset.get(0))));
+ func.implementation = function ([texture, location, offset], node) {
+ return boxVector(checkUndefined(node.origin.originString, "Texture read out of bounds", texture.loadValue().elementChecked(0, location.get(2), 0, location.get(1) + offset.get(1), location.get(0) + offset.get(0))));
}
});
- this._map.set(
- `native void GetDimensions(Texture2D<${type}${length}>,uint MipLevel,uint* thread Width,uint* thread Height,uint* thread NumberOfLevels)`,
- func => {
- func.implementation = function([texture, miplevel, width, height, numberOfLevels]) {
- let tex = texture.loadValue();
- let mipID = miplevel.loadValue();
- if (mipID >= tex.levelCount)
- throw new WTrapError("[GetDimensions]", "Reading from nonexistant mip level of texture");
- if (width.loadValue())
- width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1);
- if (height.loadValue())
- height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1);
- if (numberOfLevels.loadValue())
- numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1);
+ for (let addressSpace1 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace2 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace3 of ["thread", "threadgroup", "device"]) {
+ this._map.set(
+ `native void GetDimensions(Texture2D<${type}${length}>,uint MipLevel,uint* ${addressSpace1} Width,uint* ${addressSpace2} Height,uint* ${addressSpace3} NumberOfLevels)`,
+ func => {
+ func.implementation = function([texture, miplevel, width, height, numberOfLevels], node) {
+ let tex = texture.loadValue();
+ let mipID = miplevel.loadValue();
+ if (mipID >= tex.levelCount)
+ throw new WTrapError(node.origin.originString, "Reading from nonexistant mip level of texture");
+ if (width.loadValue())
+ width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1);
+ if (height.loadValue())
+ height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1);
+ if (numberOfLevels.loadValue())
+ numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1);
+ }
+ });
}
- });
+ }
+ }
- this._map.set(
+ this._map.set(
`native ${type}${length} Sample(Texture2DArray<${type}${length}>,sampler,float3 location)`,
func => {
func.implementation = function([texture, sampler, location]) {
this._map.set(
`native ${type}${length} Load(Texture2DArray<${type}${length}>,int4 location)`,
func => {
- func.implementation = function ([texture, location]) {
- return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(location.get(3), location.get(2), 0, location.get(1), location.get(0))));
+ func.implementation = function ([texture, location], node) {
+ return boxVector(checkUndefined(node.origin.originString, "Texture read out of bounds", texture.loadValue().elementChecked(location.get(3), location.get(2), 0, location.get(1), location.get(0))));
}
});
this._map.set(
`native ${type}${length} Load(Texture2DArray<${type}${length}>,int4 location,int2 offset)`,
func => {
- func.implementation = function ([texture, location, offset]) {
- return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(location.get(3), location.get(2), 0, location.get(1) + offset.get(1), location.get(0) + offset.get(0))));
- }
- });
- this._map.set(
- `native void GetDimensions(Texture2DArray<${type}${length}>,uint MipLevel,uint* thread Width,uint* thread Height,uint* thread Elements,uint* thread NumberOfLevels)`,
- func => {
- func.implementation = function([texture, miplevel, width, height, elements, numberOfLevels]) {
- let tex = texture.loadValue();
- let mipID = miplevel.loadValue();
- if (mipID >= tex.levelCount)
- throw new WTrapError("[GetDimensions]", "Reading from nonexistant mip level of texture");
- if (width.loadValue())
- width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1);
- if (height.loadValue())
- height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1);
- if (elements.loadValue())
- elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1);
- if (numberOfLevels.loadValue())
- numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1);
+ func.implementation = function ([texture, location, offset], node) {
+ return boxVector(checkUndefined(node.origin.originString, "Texture read out of bounds", texture.loadValue().elementChecked(location.get(3), location.get(2), 0, location.get(1) + offset.get(1), location.get(0) + offset.get(0))));
+ }
+ });
+ for (let addressSpace1 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace2 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace3 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace4 of ["thread", "threadgroup", "device"]) {
+ this._map.set(
+ `native void GetDimensions(Texture2DArray<${type}${length}>,uint MipLevel,uint* ${addressSpace1} Width,uint* ${addressSpace2} Height,uint* ${addressSpace3} Elements,uint* ${addressSpace4} NumberOfLevels)`,
+ func => {
+ func.implementation = function([texture, miplevel, width, height, elements, numberOfLevels], node) {
+ let tex = texture.loadValue();
+ let mipID = miplevel.loadValue();
+ if (mipID >= tex.levelCount)
+ throw new WTrapError(node.origin.originString, "Reading from nonexistant mip level of texture");
+ if (width.loadValue())
+ width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1);
+ if (height.loadValue())
+ height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1);
+ if (elements.loadValue())
+ elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1);
+ if (numberOfLevels.loadValue())
+ numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1);
+ }
+ });
+ }
}
- });
+ }
+ }
- this._map.set(
+ this._map.set(
`native ${type}${length} Sample(Texture3D<${type}${length}>,sampler,float3 location)`,
func => {
func.implementation = function([texture, sampler, location]) {
this._map.set(
`native ${type}${length} Load(Texture3D<${type}${length}>,int4 location)`,
func => {
- func.implementation = function ([texture, location]) {
- return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(0, location.get(3), location.get(2), location.get(1), location.get(0))));
+ func.implementation = function ([texture, location], node) {
+ return boxVector(checkUndefined(node.origin.originString, "Texture read out of bounds", texture.loadValue().elementChecked(0, location.get(3), location.get(2), location.get(1), location.get(0))));
}
});
this._map.set(
`native ${type}${length} Load(Texture3D<${type}${length}>,int4 location,int3 offset)`,
func => {
- func.implementation = function ([texture, location, offset]) {
- return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(0, location.get(3), location.get(2) + offset.get(2), location.get(1) + offset.get(1), location.get(0) + offset.get(0))));
- }
- });
- this._map.set(
- `native void GetDimensions(Texture3D<${type}${length}>,uint MipLevel,uint* thread Width,uint* thread Height,uint* thread Depth,uint* thread NumberOfLevels)`,
- func => {
- func.implementation = function([texture, miplevel, width, height, depth, numberOfLevels]) {
- let tex = texture.loadValue();
- let mipID = miplevel.loadValue();
- if (mipID >= tex.levelCount)
- throw new WTrapError("[GetDimensions]", "Reading from nonexistant mip level of texture");
- if (width.loadValue())
- width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1);
- if (height.loadValue())
- height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1);
- if (depth.loadValue())
- depth.loadValue().copyFrom(EPtr.box(tex.depthAtLevel(mipID)), 1);
- if (numberOfLevels.loadValue())
- numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1);
+ func.implementation = function ([texture, location, offset], node) {
+ return boxVector(checkUndefined(node.origin.originString, "Texture read out of bounds", texture.loadValue().elementChecked(0, location.get(3), location.get(2) + offset.get(2), location.get(1) + offset.get(1), location.get(0) + offset.get(0))));
+ }
+ });
+ for (let addressSpace1 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace2 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace3 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace4 of ["thread", "threadgroup", "device"]) {
+ this._map.set(
+ `native void GetDimensions(Texture3D<${type}${length}>,uint MipLevel,uint* ${addressSpace1} Width,uint* ${addressSpace2} Height,uint* ${addressSpace3} Depth,uint* ${addressSpace4} NumberOfLevels)`,
+ func => {
+ func.implementation = function([texture, miplevel, width, height, depth, numberOfLevels], node) {
+ let tex = texture.loadValue();
+ let mipID = miplevel.loadValue();
+ if (mipID >= tex.levelCount)
+ throw new WTrapError(node.origin.originString, "Reading from nonexistant mip level of texture");
+ if (width.loadValue())
+ width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1);
+ if (height.loadValue())
+ height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1);
+ if (depth.loadValue())
+ depth.loadValue().copyFrom(EPtr.box(tex.depthAtLevel(mipID)), 1);
+ if (numberOfLevels.loadValue())
+ numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1);
+ }
+ });
+ }
}
- });
+ }
+ }
- this._map.set(
+ this._map.set(
`native ${type}${length} Sample(TextureCube<${type}${length}>,sampler,float3 location)`,
func => {
func.implementation = function([texture, sampler, location]) {
}
}
}
- this._map.set(
- `native void GetDimensions(TextureCube<${type}${length}>,uint MipLevel,uint* thread Width,uint* thread Height,uint* thread NumberOfLevels)`,
- func => {
- func.implementation = function([texture, miplevel, width, height, numberOfLevels]) {
- let tex = texture.loadValue();
- let mipID = miplevel.loadValue();
- if (tex.layerCount != 6)
- throw new Error("Cube texture doesn't have 6 faces");
- if (mipID >= tex.levelCount)
- throw new WTrapError("[GetDimensions]", "Reading from nonexistant mip level of texture");
- if (width.loadValue())
- width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1);
- if (height.loadValue())
- height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1);
- if (numberOfLevels.loadValue())
- numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1);
+ for (let addressSpace1 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace2 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace3 of ["thread", "threadgroup", "device"]) {
+ this._map.set(
+ `native void GetDimensions(TextureCube<${type}${length}>,uint MipLevel,uint* ${addressSpace1} Width,uint* ${addressSpace2} Height,uint* ${addressSpace3} NumberOfLevels)`,
+ func => {
+ func.implementation = function([texture, miplevel, width, height, numberOfLevels], node) {
+ let tex = texture.loadValue();
+ let mipID = miplevel.loadValue();
+ if (tex.layerCount != 6)
+ throw new Error("Cube texture doesn't have 6 faces");
+ if (mipID >= tex.levelCount)
+ throw new WTrapError(node.origin.originString, "Reading from nonexistant mip level of texture");
+ if (width.loadValue())
+ width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1);
+ if (height.loadValue())
+ height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1);
+ if (numberOfLevels.loadValue())
+ numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1);
+ }
+ });
}
- });
+ }
+ }
- this._map.set(
- `native void GetDimensions(RWTexture1D<${type}${length}>,uint* thread Width)`,
- func => {
- func.implementation = function([texture, width]) {
- if (width.loadValue())
- width.loadValue().copyFrom(EPtr.box(texture.loadValue().width), 1);
- }
- });
- this._map.set(
- `native void GetDimensions(RWTexture1D<${type}${length}>,float* thread Width)`,
- func => {
- func.implementation = function([texture, width]) {
- if (width.loadValue())
- width.loadValue().copyFrom(EPtr.box(texture.loadValue().width), 1);
- }
- });
+ for (let addressSpace of ["thread", "threadgroup", "device"]) {
+ this._map.set(
+ `native void GetDimensions(RWTexture1D<${type}${length}>,uint* ${addressSpace} Width)`,
+ func => {
+ func.implementation = function([texture, width]) {
+ if (width.loadValue())
+ width.loadValue().copyFrom(EPtr.box(texture.loadValue().width), 1);
+ }
+ });
+ this._map.set(
+ `native void GetDimensions(RWTexture1D<${type}${length}>,float* ${addressSpace} Width)`,
+ func => {
+ func.implementation = function([texture, width]) {
+ if (width.loadValue())
+ width.loadValue().copyFrom(EPtr.box(texture.loadValue().width), 1);
+ }
+ });
+ }
this._map.set(
`native ${type}${length} Load(RWTexture1D<${type}${length}>,int location)`,
func => {
- func.implementation = function ([texture, location]) {
- return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(0, 0, 0, 0, location.loadValue())));
+ func.implementation = function ([texture, location], node) {
+ return boxVector(checkUndefined(node.origin.originString, "Texture read out of bounds", texture.loadValue().elementChecked(0, 0, 0, 0, location.loadValue())));
}
});
this._map.set(
`native void Store(RWTexture1D<${type}${length}>,${type}${length},uint location)`,
func => {
- func.implementation = function ([texture, value, location]) {
- checkFalse("[Store]", "Texture write out of bounds", texture.loadValue().setElementChecked(0, 0, 0, 0, location.loadValue(), unboxVector(value, length)));
+ func.implementation = function ([texture, value, location], node) {
+ checkFalse(node.origin.originString, "Texture write out of bounds", texture.loadValue().setElementChecked(0, 0, 0, 0, location.loadValue(), unboxVector(value, length)));
}
});
- this._map.set(
- `native void GetDimensions(RWTexture1DArray<${type}${length}>,uint* thread Width,uint* thread Elements)`,
- func => {
- func.implementation = function([texture, width, elements]) {
- let tex = texture.loadValue();
- if (width.loadValue())
- width.loadValue().copyFrom(EPtr.box(tex.width), 1);
- if (elements.loadValue())
- elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1);
- }
- });
- this._map.set(
- `native void GetDimensions(RWTexture1DArray<${type}${length}>,float* thread Width,uint* thread Elements)`,
- func => {
- func.implementation = function([texture, width, elements]) {
- let tex = texture.loadValue();
- if (width.loadValue())
- width.loadValue().copyFrom(EPtr.box(tex.width), 1);
- if (elements.loadValue())
- elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1);
- }
- });
+ for (let addressSpace1 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace2 of ["thread", "threadgroup", "device"]) {
+ this._map.set(
+ `native void GetDimensions(RWTexture1DArray<${type}${length}>,uint* ${addressSpace1} Width,uint* ${addressSpace2} Elements)`,
+ func => {
+ func.implementation = function([texture, width, elements]) {
+ let tex = texture.loadValue();
+ if (width.loadValue())
+ width.loadValue().copyFrom(EPtr.box(tex.width), 1);
+ if (elements.loadValue())
+ elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1);
+ }
+ });
+ this._map.set(
+ `native void GetDimensions(RWTexture1DArray<${type}${length}>,float* ${addressSpace1} Width,uint* ${addressSpace2} Elements)`,
+ func => {
+ func.implementation = function([texture, width, elements]) {
+ let tex = texture.loadValue();
+ if (width.loadValue())
+ width.loadValue().copyFrom(EPtr.box(tex.width), 1);
+ if (elements.loadValue())
+ elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1);
+ }
+ });
+ }
+ }
this._map.set(
`native ${type}${length} Load(RWTexture1DArray<${type}${length}>,int2 location)`,
func => {
- func.implementation = function ([texture, location]) {
- return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(location.get(1), 0, 0, 0, location.get(0))));
+ func.implementation = function ([texture, location], node) {
+ return boxVector(checkUndefined(node.origin.originString, "Texture read out of bounds", texture.loadValue().elementChecked(location.get(1), 0, 0, 0, location.get(0))));
}
});
this._map.set(
`native void Store(RWTexture1DArray<${type}${length}>,${type}${length},uint2 location)`,
func => {
- func.implementation = function ([texture, value, location]) {
- checkFalse("[Store]", "Texture write out of bounds", texture.loadValue().setElementChecked(location.get(1), 0, 0, 0, location.get(0), unboxVector(value, length)));
+ func.implementation = function ([texture, value, location], node) {
+ checkFalse(node.origin.originString, "Texture write out of bounds", texture.loadValue().setElementChecked(location.get(1), 0, 0, 0, location.get(0), unboxVector(value, length)));
}
});
- this._map.set(
- `native void GetDimensions(RWTexture2D<${type}${length}>,uint* thread Width,uint* thread Height)`,
- func => {
- func.implementation = function([texture, width, height]) {
- let tex = texture.loadValue();
- if (width.loadValue())
- width.loadValue().copyFrom(EPtr.box(tex.width), 1);
- if (height.loadValue())
- height.loadValue().copyFrom(EPtr.box(tex.height), 1);
- }
- });
- this._map.set(
- `native void GetDimensions(RWTexture2D<${type}${length}>,float* thread Width,float* thread Height)`,
- func => {
- func.implementation = function([texture, width, height]) {
- let tex = texture.loadValue();
- if (width.loadValue())
- width.loadValue().copyFrom(EPtr.box(tex.width), 1);
- if (height.loadValue())
- height.loadValue().copyFrom(EPtr.box(tex.height), 1);
- }
- });
+ for (let addressSpace1 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace2 of ["thread", "threadgroup", "device"]) {
+ this._map.set(
+ `native void GetDimensions(RWTexture2D<${type}${length}>,uint* ${addressSpace1} Width,uint* ${addressSpace2} Height)`,
+ func => {
+ func.implementation = function([texture, width, height]) {
+ let tex = texture.loadValue();
+ if (width.loadValue())
+ width.loadValue().copyFrom(EPtr.box(tex.width), 1);
+ if (height.loadValue())
+ height.loadValue().copyFrom(EPtr.box(tex.height), 1);
+ }
+ });
+ this._map.set(
+ `native void GetDimensions(RWTexture2D<${type}${length}>,float* ${addressSpace1} Width,float* ${addressSpace2} Height)`,
+ func => {
+ func.implementation = function([texture, width, height]) {
+ let tex = texture.loadValue();
+ if (width.loadValue())
+ width.loadValue().copyFrom(EPtr.box(tex.width), 1);
+ if (height.loadValue())
+ height.loadValue().copyFrom(EPtr.box(tex.height), 1);
+ }
+ });
+ }
+ }
this._map.set(
`native ${type}${length} Load(RWTexture2D<${type}${length}>,int2 location)`,
func => {
- func.implementation = function ([texture, location]) {
- return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(0, 0, 0, location.get(1), location.get(0))));
+ func.implementation = function ([texture, location], node) {
+ return boxVector(checkUndefined(node.origin.originString, "Texture read out of bounds", texture.loadValue().elementChecked(0, 0, 0, location.get(1), location.get(0))));
}
});
this._map.set(
`native void Store(RWTexture2D<${type}${length}>,${type}${length},uint2 location)`,
func => {
- func.implementation = function ([texture, value, location]) {
- checkFalse("[Store]", "Texture write out of bounds", texture.loadValue().setElementChecked(0, 0, 0, location.get(1), location.get(0), unboxVector(value, length)));
+ func.implementation = function ([texture, value, location], node) {
+ checkFalse(node.origin.originString, "Texture write out of bounds", texture.loadValue().setElementChecked(0, 0, 0, location.get(1), location.get(0), unboxVector(value, length)));
}
});
- this._map.set(
- `native void GetDimensions(RWTexture2DArray<${type}${length}>,uint* thread Width,uint* thread Height,uint* thread Elements)`,
- func => {
- func.implementation = function([texture, width, height, elements]) {
- let tex = texture.loadValue();
- if (width.loadValue())
- width.loadValue().copyFrom(EPtr.box(tex.width), 1);
- if (height.loadValue())
- height.loadValue().copyFrom(EPtr.box(tex.height), 1);
- if (elements.loadValue())
- elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1);
- }
- });
- this._map.set(
- `native void GetDimensions(RWTexture2DArray<${type}${length}>,float* thread Width,float* thread Height,float* thread Elements)`,
- func => {
- func.implementation = function([texture, width, height, elements]) {
- let tex = texture.loadValue();
- if (width.loadValue())
- width.loadValue().copyFrom(EPtr.box(tex.width), 1);
- if (height.loadValue())
- height.loadValue().copyFrom(EPtr.box(tex.height), 1);
- if (elements.loadValue())
- elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1);
+ for (let addressSpace1 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace2 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace3 of ["thread", "threadgroup", "device"]) {
+ this._map.set(
+ `native void GetDimensions(RWTexture2DArray<${type}${length}>,uint* ${addressSpace1} Width,uint* ${addressSpace2} Height,uint* ${addressSpace3} Elements)`,
+ func => {
+ func.implementation = function([texture, width, height, elements]) {
+ let tex = texture.loadValue();
+ if (width.loadValue())
+ width.loadValue().copyFrom(EPtr.box(tex.width), 1);
+ if (height.loadValue())
+ height.loadValue().copyFrom(EPtr.box(tex.height), 1);
+ if (elements.loadValue())
+ elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1);
+ }
+ });
+ this._map.set(
+ `native void GetDimensions(RWTexture2DArray<${type}${length}>,float* ${addressSpace1} Width,float* ${addressSpace2} Height,float* ${addressSpace3} Elements)`,
+ func => {
+ func.implementation = function([texture, width, height, elements]) {
+ let tex = texture.loadValue();
+ if (width.loadValue())
+ width.loadValue().copyFrom(EPtr.box(tex.width), 1);
+ if (height.loadValue())
+ height.loadValue().copyFrom(EPtr.box(tex.height), 1);
+ if (elements.loadValue())
+ elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1);
+ }
+ });
}
- });
+ }
+ }
this._map.set(
`native ${type}${length} Load(RWTexture2DArray<${type}${length}>,int3 location)`,
func => {
- func.implementation = function ([texture, location]) {
- return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(location.get(2), 0, 0, location.get(1), location.get(0))));
+ func.implementation = function ([texture, location], node) {
+ return boxVector(checkUndefined(node.origin.originString, "Texture read out of bounds", texture.loadValue().elementChecked(location.get(2), 0, 0, location.get(1), location.get(0))));
}
});
this._map.set(
`native void Store(RWTexture2DArray<${type}${length}>,${type}${length},uint3 location)`,
func => {
- func.implementation = function ([texture, value, location]) {
- checkFalse("[Store]", "Texture write out of bounds", texture.loadValue().setElementChecked(location.get(2), 0, 0, location.get(1), location.get(0), unboxVector(value, length)));
+ func.implementation = function ([texture, value, location], node) {
+ checkFalse(node.origin.originString, "Texture write out of bounds", texture.loadValue().setElementChecked(location.get(2), 0, 0, location.get(1), location.get(0), unboxVector(value, length)));
}
});
- this._map.set(
- `native void GetDimensions(RWTexture3D<${type}${length}>,uint* thread Width,uint* thread Height,uint* thread Depth)`,
- func => {
- func.implementation = function([texture, width, height, depth]) {
- let tex = texture.loadValue();
- if (width.loadValue())
- width.loadValue().copyFrom(EPtr.box(tex.width), 1);
- if (height.loadValue())
- height.loadValue().copyFrom(EPtr.box(tex.height), 1);
- if (depth.loadValue())
- depth.loadValue().copyFrom(EPtr.box(tex.depth), 1);
- }
- });
- this._map.set(
- `native void GetDimensions(RWTexture3D<${type}${length}>,float* thread Width,float* thread Height,float* thread Depth)`,
- func => {
- func.implementation = function([texture, width, height, depth]) {
- let tex = texture.loadValue();
- if (width.loadValue())
- width.loadValue().copyFrom(EPtr.box(tex.width), 1);
- if (height.loadValue())
- height.loadValue().copyFrom(EPtr.box(tex.height), 1);
- if (depth.loadValue())
- depth.loadValue().copyFrom(EPtr.box(tex.depth), 1);
+ for (let addressSpace1 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace2 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace3 of ["thread", "threadgroup", "device"]) {
+ this._map.set(
+ `native void GetDimensions(RWTexture3D<${type}${length}>,uint* ${addressSpace1} Width,uint* ${addressSpace2} Height,uint* ${addressSpace3} Depth)`,
+ func => {
+ func.implementation = function([texture, width, height, depth]) {
+ let tex = texture.loadValue();
+ if (width.loadValue())
+ width.loadValue().copyFrom(EPtr.box(tex.width), 1);
+ if (height.loadValue())
+ height.loadValue().copyFrom(EPtr.box(tex.height), 1);
+ if (depth.loadValue())
+ depth.loadValue().copyFrom(EPtr.box(tex.depth), 1);
+ }
+ });
+ this._map.set(
+ `native void GetDimensions(RWTexture3D<${type}${length}>,float* ${addressSpace1} Width,float* ${addressSpace2} Height,float* ${addressSpace3} Depth)`,
+ func => {
+ func.implementation = function([texture, width, height, depth]) {
+ let tex = texture.loadValue();
+ if (width.loadValue())
+ width.loadValue().copyFrom(EPtr.box(tex.width), 1);
+ if (height.loadValue())
+ height.loadValue().copyFrom(EPtr.box(tex.height), 1);
+ if (depth.loadValue())
+ depth.loadValue().copyFrom(EPtr.box(tex.depth), 1);
+ }
+ });
}
- });
+ }
+ }
this._map.set(
`native ${type}${length} Load(RWTexture3D<${type}${length}>,int3 location)`,
func => {
- func.implementation = function ([texture, location]) {
- return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(0, 0, location.get(2), location.get(1), location.get(0))));
+ func.implementation = function ([texture, location], node) {
+ return boxVector(checkUndefined(node.origin.originString, "Texture read out of bounds", texture.loadValue().elementChecked(0, 0, location.get(2), location.get(1), location.get(0))));
}
});
this._map.set(
`native void Store(RWTexture3D<${type}${length}>,${type}${length},uint3 location)`,
func => {
- func.implementation = function ([texture, value, location]) {
- checkFalse("[Store]", "Texture write out of bounds", texture.loadValue().setElementChecked(0, 0, location.get(2), location.get(1), location.get(0), unboxVector(value, length)));
+ func.implementation = function ([texture, value, location], node) {
+ checkFalse(node.origin.originString, "Texture write out of bounds", texture.loadValue().setElementChecked(0, 0, location.get(2), location.get(1), location.get(0), unboxVector(value, length)));
}
});
}
this._map.set(
`native ${type} Load(TextureDepth2D<${type}>,int3 location)`,
func => {
- func.implementation = function ([texture, location]) {
- return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(0, location.get(2), 0, location.get(1), location.get(0))));
+ func.implementation = function ([texture, location], node) {
+ return boxVector(checkUndefined(node.origin.originString, "Texture read out of bounds", texture.loadValue().elementChecked(0, location.get(2), 0, location.get(1), location.get(0))));
}
});
this._map.set(
`native ${type} Load(TextureDepth2D<${type}>,int3 location,int2 offset)`,
func => {
- func.implementation = function ([texture, location, offset]) {
- return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(0, location.get(2), 0, location.get(1) + offset.get(1), location.get(0) + offset.get(0))));
+ func.implementation = function ([texture, location, offset], node) {
+ return boxVector(checkUndefined(node.origin.originString, "Texture read out of bounds", texture.loadValue().elementChecked(0, location.get(2), 0, location.get(1) + offset.get(1), location.get(0) + offset.get(0))));
}
});
- this._map.set(
- `native void GetDimensions(TextureDepth2D<${type}>,uint MipLevel,uint* thread Width,uint* thread Height,uint* thread NumberOfLevels)`,
- func => {
- func.implementation = function ([texture, miplevel, width, height, numberOfLevels]) {
- let tex = texture.loadValue();
- let mipID = miplevel.loadValue();
- if (mipID >= tex.levelCount)
- throw new WTrapError("[GetDimensions]", "Reading from nonexistant mip level of texture");
- if (width.loadValue())
- width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1);
- if (height.loadValue())
- height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1);
- if (numberOfLevels.loadValue())
- numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1);
+ for (let addressSpace1 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace2 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace3 of ["thread", "threadgroup", "device"]) {
+ this._map.set(
+ `native void GetDimensions(TextureDepth2D<${type}>,uint MipLevel,uint* ${addressSpace1} Width,uint* ${addressSpace2} Height,uint* ${addressSpace3} NumberOfLevels)`,
+ func => {
+ func.implementation = function ([texture, miplevel, width, height, numberOfLevels], node) {
+ let tex = texture.loadValue();
+ let mipID = miplevel.loadValue();
+ if (mipID >= tex.levelCount)
+ throw new WTrapError(node.origin.originString, "Reading from nonexistant mip level of texture");
+ if (width.loadValue())
+ width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1);
+ if (height.loadValue())
+ height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1);
+ if (numberOfLevels.loadValue())
+ numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1);
+ }
+ });
}
- });
+ }
+ }
this._map.set(
`native ${type} Sample(TextureDepth2DArray<${type}>,sampler,float3 location)`,
func => {
this._map.set(
`native ${type} Load(TextureDepth2DArray<${type}>,int4 location)`,
func => {
- func.implementation = function ([texture, location]) {
- return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(location.get(3), location.get(2), 0, location.get(1), location.get(0))));
+ func.implementation = function ([texture, location], node) {
+ return boxVector(checkUndefined(node.origin.originString, "Texture read out of bounds", texture.loadValue().elementChecked(location.get(3), location.get(2), 0, location.get(1), location.get(0))));
}
});
this._map.set(
`native ${type} Load(TextureDepth2DArray<${type}>,int4 location,int2 offset)`,
func => {
- func.implementation = function ([texture, location, offset]) {
- return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(location.get(3), location.get(2), 0, location.get(1) + offset.get(1), location.get(0) + offset.get(0))));
+ func.implementation = function ([texture, location, offset], node) {
+ return boxVector(checkUndefined(node.origin.originString, "Texture read out of bounds", texture.loadValue().elementChecked(location.get(3), location.get(2), 0, location.get(1) + offset.get(1), location.get(0) + offset.get(0))));
}
});
- this._map.set(
- `native void GetDimensions(TextureDepth2DArray<${type}>,uint MipLevel,uint* thread Width,uint* thread Height,uint* thread Elements,uint* thread NumberOfLevels)`,
- func => {
- func.implementation = function ([texture, miplevel, width, height, elements, numberOfLevels]) {
- let tex = texture.loadValue();
- let mipID = miplevel.loadValue();
- if (mipID >= tex.levelCount)
- throw new WTrapError("[GetDimensions]", "Reading from nonexistant mip level of texture");
- if (width.loadValue())
- width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1);
- if (height.loadValue())
- height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1);
- if (elements.loadValue())
- elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1);
- if (numberOfLevels.loadValue())
- numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1);
+ for (let addressSpace1 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace2 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace3 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace4 of ["thread", "threadgroup", "device"]) {
+ this._map.set(
+ `native void GetDimensions(TextureDepth2DArray<${type}>,uint MipLevel,uint* ${addressSpace1} Width,uint* ${addressSpace2} Height,uint* ${addressSpace3} Elements,uint* ${addressSpace4} NumberOfLevels)`,
+ func => {
+ func.implementation = function ([texture, miplevel, width, height, elements, numberOfLevels], node) {
+ let tex = texture.loadValue();
+ let mipID = miplevel.loadValue();
+ if (mipID >= tex.levelCount)
+ throw new WTrapError(node.origin.originString, "Reading from nonexistant mip level of texture");
+ if (width.loadValue())
+ width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1);
+ if (height.loadValue())
+ height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1);
+ if (elements.loadValue())
+ elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1);
+ if (numberOfLevels.loadValue())
+ numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1);
+ }
+ });
+ }
}
- });
+ }
+ }
this._map.set(
`native ${type} Sample(TextureDepthCube<${type}>,sampler,float3 location)`,
func => {
return boxVector(gatherTexture(texture.loadValue(), sampler.loadValue(), locationArray, undefined, undefined, undefined, undefined, undefined, compareValue.loadValue(), 0));
}
});
- this._map.set(
- `native void GetDimensions(TextureDepthCube<${type}>,uint MipLevel,uint* thread Width,uint* thread Height,uint* thread NumberOfLevels)`,
- func => {
- func.implementation = function ([texture, miplevel, width, height, numberOfLevels]) {
- let tex = texture.loadValue();
- let mipID = miplevel.loadValue();
- if (tex.layerCount != 6)
- throw new Error("Cube texture doesn't have 6 faces");
- if (mipID >= tex.levelCount)
- throw new WTrapError("[GetDimensions]", "Reading from nonexistant mip level of texture");
- if (width.loadValue())
- width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1);
- if (height.loadValue())
- height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1);
- if (numberOfLevels.loadValue())
- numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1);
- }
- });
- this._map.set(
- `native void GetDimensions(RWTextureDepth2D<${type}>,uint* thread Width,uint* thread Height)`,
- func => {
- func.implementation = function ([texture, width, height]) {
- let tex = texture.loadValue();
- if (width.loadValue())
- width.loadValue().copyFrom(EPtr.box(tex.width), 1);
- if (height.loadValue())
- height.loadValue().copyFrom(EPtr.box(tex.height), 1);
- }
- });
- this._map.set(
- `native void GetDimensions(RWTextureDepth2D<${type}>,float* thread Width,float* thread Height)`,
- func => {
- func.implementation = function ([texture, width, height]) {
- let tex = texture.loadValue();
- if (width.loadValue())
- width.loadValue().copyFrom(EPtr.box(tex.width), 1);
- if (height.loadValue())
- height.loadValue().copyFrom(EPtr.box(tex.height), 1);
+ for (let addressSpace1 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace2 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace3 of ["thread", "threadgroup", "device"]) {
+ this._map.set(
+ `native void GetDimensions(TextureDepthCube<${type}>,uint MipLevel,uint* ${addressSpace1} Width,uint* ${addressSpace2} Height,uint* ${addressSpace3} NumberOfLevels)`,
+ func => {
+ func.implementation = function ([texture, miplevel, width, height, numberOfLevels], node) {
+ let tex = texture.loadValue();
+ let mipID = miplevel.loadValue();
+ if (tex.layerCount != 6)
+ throw new Error("Cube texture doesn't have 6 faces");
+ if (mipID >= tex.levelCount)
+ throw new WTrapError(node.origin.originString, "Reading from nonexistant mip level of texture");
+ if (width.loadValue())
+ width.loadValue().copyFrom(EPtr.box(tex.widthAtLevel(mipID)), 1);
+ if (height.loadValue())
+ height.loadValue().copyFrom(EPtr.box(tex.heightAtLevel(mipID)), 1);
+ if (numberOfLevels.loadValue())
+ numberOfLevels.loadValue().copyFrom(EPtr.box(tex.levelCount), 1);
+ }
+ });
}
- });
+ }
+ }
+ for (let addressSpace1 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace2 of ["thread", "threadgroup", "device"]) {
+ this._map.set(
+ `native void GetDimensions(RWTextureDepth2D<${type}>,uint* ${addressSpace1} Width,uint* ${addressSpace2} Height)`,
+ func => {
+ func.implementation = function ([texture, width, height]) {
+ let tex = texture.loadValue();
+ if (width.loadValue())
+ width.loadValue().copyFrom(EPtr.box(tex.width), 1);
+ if (height.loadValue())
+ height.loadValue().copyFrom(EPtr.box(tex.height), 1);
+ }
+ });
+ this._map.set(
+ `native void GetDimensions(RWTextureDepth2D<${type}>,float* ${addressSpace1} Width,float* ${addressSpace2} Height)`,
+ func => {
+ func.implementation = function ([texture, width, height]) {
+ let tex = texture.loadValue();
+ if (width.loadValue())
+ width.loadValue().copyFrom(EPtr.box(tex.width), 1);
+ if (height.loadValue())
+ height.loadValue().copyFrom(EPtr.box(tex.height), 1);
+ }
+ });
+ }
+ }
this._map.set(
`native ${type} Load(RWTextureDepth2D<${type}>,int2 location)`,
func => {
- func.implementation = function ([texture, location]) {
- return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(0, 0, 0, location.get(1), location.get(0))));
+ func.implementation = function ([texture, location], node) {
+ return boxVector(checkUndefined(node.origin.originString, "Texture read out of bounds", texture.loadValue().elementChecked(0, 0, 0, location.get(1), location.get(0))));
}
});
this._map.set(
`native void Store(RWTextureDepth2D<${type}>,${type},uint2 location)`,
func => {
- func.implementation = function ([texture, value, location]) {
- checkFalse("[Store]", "Texture write out of bounds", texture.loadValue().setElementChecked(0, 0, 0, location.get(1), location.get(0), unboxVector(value, "")));
- }
- });
- this._map.set(
- `native void GetDimensions(RWTextureDepth2DArray<${type}>,uint* thread Width,uint* thread Height,uint* thread Elements)`,
- func => {
- func.implementation = function ([texture, width, height, elements]) {
- let tex = texture.loadValue();
- if (width.loadValue())
- width.loadValue().copyFrom(EPtr.box(tex.width), 1);
- if (height.loadValue())
- height.loadValue().copyFrom(EPtr.box(tex.height), 1);
- if (elements.loadValue())
- elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1);
+ func.implementation = function ([texture, value, location], node) {
+ checkFalse(node.origin.originString, "Texture write out of bounds", texture.loadValue().setElementChecked(0, 0, 0, location.get(1), location.get(0), unboxVector(value, "")));
}
});
- this._map.set(
- `native void GetDimensions(RWTextureDepth2DArray<${type}>,float* thread Width,float* thread Height,float* thread Elements)`,
- func => {
- func.implementation = function ([texture, width, height, elements]) {
- let tex = texture.loadValue();
- if (width.loadValue())
- width.loadValue().copyFrom(EPtr.box(tex.width), 1);
- if (height.loadValue())
- height.loadValue().copyFrom(EPtr.box(tex.height), 1);
- if (elements.loadValue())
- elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1);
+ for (let addressSpace1 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace2 of ["thread", "threadgroup", "device"]) {
+ for (let addressSpace3 of ["thread", "threadgroup", "device"]) {
+ this._map.set(
+ `native void GetDimensions(RWTextureDepth2DArray<${type}>,uint* ${addressSpace1} Width,uint* ${addressSpace2} Height,uint* ${addressSpace3} Elements)`,
+ func => {
+ func.implementation = function ([texture, width, height, elements]) {
+ let tex = texture.loadValue();
+ if (width.loadValue())
+ width.loadValue().copyFrom(EPtr.box(tex.width), 1);
+ if (height.loadValue())
+ height.loadValue().copyFrom(EPtr.box(tex.height), 1);
+ if (elements.loadValue())
+ elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1);
+ }
+ });
+ this._map.set(
+ `native void GetDimensions(RWTextureDepth2DArray<${type}>,float* ${addressSpace1} Width,float* ${addressSpace2} Height,float* ${addressSpace3} Elements)`,
+ func => {
+ func.implementation = function ([texture, width, height, elements]) {
+ let tex = texture.loadValue();
+ if (width.loadValue())
+ width.loadValue().copyFrom(EPtr.box(tex.width), 1);
+ if (height.loadValue())
+ height.loadValue().copyFrom(EPtr.box(tex.height), 1);
+ if (elements.loadValue())
+ elements.loadValue().copyFrom(EPtr.box(tex.layerCount), 1);
+ }
+ });
}
- });
+ }
+ }
this._map.set(
`native ${type} Load(RWTextureDepth2DArray<${type}>,int3 location)`,
func => {
- func.implementation = function ([texture, location]) {
- return boxVector(checkUndefined("[Load]", "Texture read out of bounds", texture.loadValue().elementChecked(location.get(2), 0, 0, location.get(1), location.get(0))));
+ func.implementation = function ([texture, location], node) {
+ return boxVector(checkUndefined(node.origin.originString, "Texture read out of bounds", texture.loadValue().elementChecked(location.get(2), 0, 0, location.get(1), location.get(0))));
}
});
this._map.set(
`native void Store(RWTextureDepth2DArray<${type}>,${type},uint3 location)`,
func => {
- func.implementation = function ([texture, value, location]) {
- checkFalse("[Store]", "Texture write out of bounds", texture.loadValue().setElementChecked(location.get(2), 0, 0, location.get(1), location.get(0), unboxVector(value, "")));
+ func.implementation = function ([texture, value, location], node) {
+ checkFalse(node.origin.originString, "Texture write out of bounds", texture.loadValue().setElementChecked(location.get(2), 0, 0, location.get(1), location.get(0), unboxVector(value, "")));
}
});
}
(function() {
print(`// This was autogenerated from Generate_Standard_Library.swift! Do not edit!!`);
print();
-
+
for (let type of [`void`, `bool`, `uchar`, `ushort`, `uint`, `char`, `short`, `int`, `half`, `float`, `atomic_int`, `atomic_uint`]) {
print(`native typedef ${type};`);
}
}
}
print();
-
+
for (let type of [`half`, `float`]) {
for (let i of [2, 3, 4]) {
for (let j of [2, 3, 4]) {
}
}
print();
-
+
for (let type1 of [`uchar`, `ushort`, `uint`, `char`, `short`, `int`, `half`, `float`]) {
for (let type2 of [`uchar`, `ushort`, `uint`, `char`, `short`, `int`, `half`, `float`]) {
if (type1 != type2) {
}
}
print();
-
+
for (let type of [`uchar`, `ushort`, `uint`, `char`, `short`, `int`, `half`, `float`]) {
print(`operator bool(${type} x) {`);
print(` return x != 0;`);
print(`}`);
}
print();
-
+
print(`native operator int(atomic_int);`);
print(`native operator uint(atomic_uint);`);
print();
-
+
print(`native bool operator==(bool, bool);`);
-
+
print(`bool operator&(bool a, bool b) {`);
print(` return a && b;`);
print(`}`);
-
+
print(`bool operator|(bool a, bool b) {`);
print(` return a || b;`);
print(`}`);
-
+
print(`bool operator^(bool a, bool b) {`);
print(` if (a)`);
print(` return !b;`);
print(` return b;`);
print(`}`);
-
+
print(`bool operator~(bool value) {`);
print(` return !value;`);
print(`}`);
-
+
for (let type of [`int`, `uint`, `float`]) {
print(`native ${type} operator+(${type}, ${type});`);
print(`native ${type} operator-(${type}, ${type});`);
print(`native bool operator>(${type}, ${type});`);
print(`native bool operator>=(${type}, ${type});`);
}
-
+
for (let type of [`int`, `uint`]) {
print(`native ${type} operator&(${type}, ${type});`);
print(`native ${type} operator|(${type}, ${type});`);
print(`native ${type} operator<<(${type}, uint);`);
print(`native ${type} operator>>(${type}, uint);`);
}
-
+
for (let type of [`uchar`, `ushort`]) {
print(`${type} operator+(${type} a, ${type} b) {`);
print(` return ${type}(uint(a) + uint(b));`);
print(`ushort operator>>(ushort a, uint b) {`);
print(` return ushort(uint(a) >> (b & 65535));`);
print(`}`);
-
+
for (let type of [`char`, `short`]) {
print(`${type} operator+(${type} a, ${type} b) {`);
print(` return ${type}(int(a) + int(b));`);
print(`short operator>>(short a, uint b) {`);
print(` return short(int(a) >> (b & 65535));`);
print(`}`);
-
+
for (let type of [`uchar`, `ushort`, `uint`, `char`, `short`, `int`, `half`, `float`]) {
print(`${type} operator++(${type} value) {`);
print(` return value + 1;`);
print(` return value - 1;`);
print(`}`);
}
-
+
print(`half operator+(half a, half b) {`);
print(` return half(float(a) + float(b));`);
print(`}`);
print(`native int operator-(int);`);
print(`native float operator-(float);`);
print();
-
+
for (let type of [`uchar`, `ushort`, `uint`, `char`, `short`, `int`, `half`, `float`]) {
for (let size of [2, 3, 4]) {
print(`${type}${size} operator+(${type}${size} a, ${type}${size} b) {`);
}
}
}
-
+
for (let type of [`bool`, `uchar`, `ushort`, `uint`, `char`, `short`, `int`, `half`, `float`]) {
print(`operator ${type}2(${type} x, ${type} y) {`);
print(` ${type}2 result;`);
print(`}`);
}
print();
-
+
for (let type of [`half`, `float`]) {
let variables = [`a`, `b`, `c`, `d`];
for (let m of [2, 3, 4]) {
}
}
print();
-
+
for (let type of [`bool`, `uchar`, `ushort`, `uint`, `char`, `short`, `int`, `half`, `float`]) {
print(`bool operator==(${type}2 a, ${type}2 b) {`);
print(` return a.x == b.x && a.y == b.y;`);
print(`}`);
}
print();
-
+
for (let type of [`half`, `float`]) {
for (let m of [2, 3, 4]) {
for (let n of [2, 3, 4]) {
}
}
print();
-
+
for (let type of [`half`, `float`]) {
for (let i of [2, 3, 4]) {
for (let j of [2, 3, 4]) {
}
}
}
-
+
function computeSwizzle(components, maxValue, maxLength) {
if (components.length == maxLength) {
return [components];
return result;
}
}
-
+
function component(value) {
switch (value) {
case 0:
fatalError();
}
}
-
+
function uniqueLength(swizzle) {
let has0 = false;
let has1 = false;
}
}
}
-
+
// These functions are unary floating-point scalar functions,
// which can also be applied to vectors and matrices component-wise.
(function() {
let nativeFunctions = [`cos`, `sin`, `tan`, `acos`, `asin`, `atan`, `cosh`, `sinh`, `tanh`, `ceil`, `exp`, `floor`, `log`, `round`, `trunc`];
let nativeFragmentFunctions = [`ddx`, `ddy`];
let nonNativeFunctions = [`sqrt`, `log2`, `log10`, `frac`, `exp2`, `degrees`, `radians`, `rcp`, `rsqrt`, `saturate`, `ddx_coarse`, `ddx_fine`, `ddy_coarse`, `ddy_fine`, `fwidth`];
-
+
for (let nativeFunction of nativeFunctions) {
print(`native float ${nativeFunction}(float);`);
print(`half ${nativeFunction}(half x) {`);
print(` return half(${nativeFunction}(float(x)));`);
print(`}`);
}
-
+
for (let nativeFunction of nativeFragmentFunctions) {
print(`native fragment float ${nativeFunction}(float);`);
print(`half ${nativeFunction}(half x) {`);
print(` return half(${nativeFunction}(float(x)));`);
print(`}`);
}
-
+
for (let type of [`half`, `float`]) {
print(`${type} sqrt(${type} x) {`);
print(` return pow(x, 0.5);`);
print(`${type} fwidth(${type} x) {`);
print(` return abs(ddx(x)) + abs(ddy(x));`);
print(`}`);
-
+
for (let outputFunction of nativeFunctions.concat(nativeFragmentFunctions.concat(nonNativeFunctions))) {
for (let size of [2, 3, 4]) {
print(`${type}${size} ${outputFunction}(${type}${size} x) {`);
print();
}
})();
-
+
// These functions are binary floating-point scalar functions,
// which can also be applied to vectors and matrices component-wise.
(function() {
let nativeFunctions = [`pow`];
-
+
for (let nativeFunction of nativeFunctions) {
print(`native float ${nativeFunction}(float, float);`);
print(`half ${nativeFunction}(half x, half y) {`);
print(` return half(${nativeFunction}(float(x), float(y)));`);
print(`}`);
}
-
+
for (let type of [`half`, `float`]) {
let nonNativeFunctions = [`step`, `ldexp`, `fmod`];
-
+
print(`${type} step(${type} y, ${type} x) {`);
print(` return x >= y ? 1 : 0;`);
print(`}`);
print(` ${type} multiple = ${type}(whole) * y;`);
print(` return x - multiple;`);
print(`}`);
-
+
for (let outputFunction of nativeFunctions.concat(nonNativeFunctions)) {
for (let size of [2, 3, 4]) {
print(`${type}${size} ${outputFunction}(${type}${size} x, ${type}${size} y) {`);
print();
}
})();
-
+
// These functions are ternary floating-point scalar functions,
// which can also be applied to vectors and matrices component-wise.
for (let type of [`half`, `float`]) {
let nonNativeFunctions = [`smoothstep`, `lerp`, `fma`, `mad`];
-
+
print(`${type} smoothstep(${type} edge0, ${type} edge1, ${type} x) {`);
print(` ${type} t = clamp((x - edge0) / (edge1 - edge0), 0, 1);`);
print(` return t * t * (3 - 2 * t);`);
print(`${type} mad(${type} x, ${type} y, ${type} z) {`);
print(` return x * y + z;`);
print(`}`);
-
+
for (let nonNativeFunction of nonNativeFunctions) {
for (let size of [2, 3, 4]) {
print(`${type}${size} ${nonNativeFunction}(${type}${size} x, ${type}${size} y, ${type}${size} z) {`);
}
print();
}
-
+
print(`native bool isnormal(half);`);
print(`native bool isnormal(float);`);
for (let type of [`half`, `float`]) {
}
print();
}
-
+
(function() {
let nativeFunctions = [`isfinite`, `isinf`, `isnan`];
-
+
for (let nativeFunction of nativeFunctions) {
print(`native bool ${nativeFunction}(float);`);
print(`bool ${nativeFunction}(half x) {`);
print(` return ${nativeFunction}(float(x));`);
print(`}`);
}
-
+
for (let type of [`half`, `float`]) {
for (let nativeFunction of nativeFunctions) {
for (let size of [2, 3, 4]) {
print();
}
})()
-
+
for (let type of [`half`, `float`]) {
let nonNativeFunctions = [`isordered`, `isunordered`];
-
+
print(`bool isordered(${type} x, ${type} y) {`);
print(` return (x == x) && (y == y);`);
print(`}`);
print(`bool isunordered(${type} x, ${type} y) {`);
print(` return isnan(x) || isnan(y);`);
print(`}`);
-
+
for (let nonNativeFunction of nonNativeFunctions) {
for (let size of [2, 3, 4]) {
print(`bool${size} ${nonNativeFunction}(${type}${size} x, ${type}${size} y) {`);
}
print();
}
-
+
print(`native float atan2(float, float);`);
print(`half atan2(half x, half y) {`);
print(` return half(atan2(float(x), float(y)));`);
}
}
print();
-
- for (let type of [`half`, `float`]) {
- print(`void sincos(${type} x, thread ${type}* y, thread ${type}* z) {`);
- print(` if (y != null)`);
- print(` *y = sin(x);`);
- print(` if (z != null)`);
- print(` *z = cos(x);`);
- print(`}`);
- for (let size of [2, 3, 4]) {
- print(`void sincos(${type}${size} x, thread ${type}${size}* y, thread ${type}${size}* z) {`);
- // Can't take a pointer to a member of a vector.
- print(` ${type} sinResult;`);
- print(` ${type} cosResult;`);
- for (let i = 0; i < size; ++i) {
- print(` sincos(x[${i}], &sinResult, &cosResult);`);
+
+ for (let addressSpace1 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace2 of [`thread`, `device`, `threadgroup`]) {
+ for (let type of [`half`, `float`]) {
+ print(`void sincos(${type} x, ${addressSpace1} ${type}* y, ${addressSpace2} ${type}* z) {`);
print(` if (y != null)`);
- print(` (*y)[${i}] = sinResult;`);
+ print(` *y = sin(x);`);
print(` if (z != null)`);
- print(` (*z)[${i}] = cosResult;`);
- }
- print(`}`);
- }
- for (let i of [2, 3, 4]) {
- for (let j of [2, 3, 4]) {
- print(`void sincos(${type}${i}x${j} x, thread ${type}${i}x${j}* y, thread ${type}${i}x${j}* z) {`);
- // Can't take a pointer to a member of a matrix.
- print(` ${type} sinResult;`);
- print(` ${type} cosResult;`);
- for (let m = 0; m < i; ++m) {
- for (let n = 0; n < j; ++n) {
- print(` sincos(x[${m}][${n}], &sinResult, &cosResult);`);
+ print(` *z = cos(x);`);
+ print(`}`);
+ for (let size of [2, 3, 4]) {
+ print(`void sincos(${type}${size} x, ${addressSpace1} ${type}${size}* y, ${addressSpace2} ${type}${size}* z) {`);
+ // Can't take a pointer to a member of a vector.
+ print(` ${type} sinResult;`);
+ print(` ${type} cosResult;`);
+ for (let i = 0; i < size; ++i) {
+ print(` sincos(x[${i}], &sinResult, &cosResult);`);
print(` if (y != null)`);
- print(` (*y)[${m}][${n}] = sinResult;`);
+ print(` (*y)[${i}] = sinResult;`);
print(` if (z != null)`);
- print(` (*z)[${m}][${n}] = cosResult;`);
+ print(` (*z)[${i}] = cosResult;`);
+ }
+ print(`}`);
+ }
+ for (let i of [2, 3, 4]) {
+ for (let j of [2, 3, 4]) {
+ print(`void sincos(${type}${i}x${j} x, ${addressSpace1} ${type}${i}x${j}* y, ${addressSpace2} ${type}${i}x${j}* z) {`);
+ // Can't take a pointer to a member of a matrix.
+ print(` ${type} sinResult;`);
+ print(` ${type} cosResult;`);
+ for (let m = 0; m < i; ++m) {
+ for (let n = 0; n < j; ++n) {
+ print(` sincos(x[${m}][${n}], &sinResult, &cosResult);`);
+ print(` if (y != null)`);
+ print(` (*y)[${m}][${n}] = sinResult;`);
+ print(` if (z != null)`);
+ print(` (*z)[${m}][${n}] = cosResult;`);
+ }
+ }
+ print(`}`);
}
}
- print(`}`);
}
}
}
print();
-
+
for (let binaryFunction of [[`all`, `true`, `&&`], [`any`, `false`, `||`]]) {
print(`bool ${binaryFunction[0]}(bool x) {`);
print(` return x;`);
}
print();
}
-
+
for (let type of [`uchar`, `ushort`, `uint`]) {
print(`${type} abs(${type} x) {`);
print(` return x;`);
}
}
print();
-
+
for (let type of [`uchar`, `ushort`, `uint`]) {
print(`${type} sign(${type} x) {`);
print(` return x == 0 ? 0 : 1;`);
}
}
print();
-
+
for (let type of [`uchar`, `ushort`, `uint`, `char`, `short`, `int`, `half`, `float`]) {
let nonNativeFunctions = [`min`, `max`];
-
+
print(`${type} min(${type} x, ${type} y) {`);
print(` return x > y ? y : x;`);
print(`}`);
print(`${type} max(${type} x, ${type} y) {`);
print(` return x > y ? x : y;`);
print(`}`);
-
+
for (let nonNativeFunction of nonNativeFunctions) {
for (let size of [2, 3, 4]) {
print(`${type}${size} ${nonNativeFunction}(${type}${size} x, ${type}${size} y) {`);
}
print();
}
-
+
for (let type of [`uchar`, `ushort`, `uint`, `char`, `short`, `int`, `half`, `float`]) {
let nonNativeFunctions = [`clamp`];
-
+
print(`${type} clamp(${type} x, ${type} lower, ${type} upper) {`);
print(` return max(min(upper, x), lower);`);
print(`}`);
-
+
for (let nonNativeFunction of nonNativeFunctions) {
for (let size of [2, 3, 4]) {
print(`${type}${size} ${nonNativeFunction}(${type}${size} x, ${type}${size} y, ${type}${size} z) {`);
}
print();
}
-
- for (let type of [`half`, `float`]) {
- print(`${type} modf(${type} x, thread ${type}* ip) {`);
- print(` uint result = uint(x);`);
- print(` if (ip != null)`);
- print(` *ip = x - ${type}(result);`);
- print(` return ${type}(result);`);
- print(`}`);
-
- for (let size of [2, 3, 4]) {
- print(`${type}${size} modf(${type}${size} x, thread ${type}${size}* y) {`);
- print(` ${type}${size} result;`);
- // Can't take a pointer to a member of a vector.
- print(` ${type} buffer;`);
- for (let i = 0; i < size; ++i) {
- print(` result[${i}] = modf(x[${i}], &buffer);`);
- print(` if (y != null)`);
- print(` (*y)[${i}] = buffer;`);
- }
- print(` return result;`);
+
+ for (let addressSpace of [`thread`, `device`, `threadgroup`]) {
+ for (let type of [`half`, `float`]) {
+ print(`${type} modf(${type} x, ${addressSpace} ${type}* ip) {`);
+ print(` uint result = uint(x);`);
+ print(` if (ip != null)`);
+ print(` *ip = x - ${type}(result);`);
+ print(` return ${type}(result);`);
print(`}`);
- }
- for (let i of [2, 3, 4]) {
- for (let j of [2, 3, 4]) {
- print(`${type}${i}x${j} modf(${type}${i}x${j} x, thread ${type}${i}x${j}* y) {`);
- print(` ${type}${i}x${j} result;`);
- // Can't take a pointer to a member of a matrix.
+
+ for (let size of [2, 3, 4]) {
+ print(`${type}${size} modf(${type}${size} x, ${addressSpace} ${type}${size}* y) {`);
+ print(` ${type}${size} result;`);
+ // Can't take a pointer to a member of a vector.
print(` ${type} buffer;`);
- for (let m = 0; m < i; ++m) {
- for (let n = 0; n < j; ++n) {
- print(` result[${m}][${n}] = modf(x[${m}][${n}], &buffer);`);
- print(` if (y != null)`);
- print(` (*y)[${m}][${n}] = buffer;`);
- }
+ for (let i = 0; i < size; ++i) {
+ print(` result[${i}] = modf(x[${i}], &buffer);`);
+ print(` if (y != null)`);
+ print(` (*y)[${i}] = buffer;`);
}
print(` return result;`);
print(`}`);
}
+ for (let i of [2, 3, 4]) {
+ for (let j of [2, 3, 4]) {
+ print(`${type}${i}x${j} modf(${type}${i}x${j} x, ${addressSpace} ${type}${i}x${j}* y) {`);
+ print(` ${type}${i}x${j} result;`);
+ // Can't take a pointer to a member of a matrix.
+ print(` ${type} buffer;`);
+ for (let m = 0; m < i; ++m) {
+ for (let n = 0; n < j; ++n) {
+ print(` result[${m}][${n}] = modf(x[${m}][${n}], &buffer);`);
+ print(` if (y != null)`);
+ print(` (*y)[${m}][${n}] = buffer;`);
+ }
+ }
+ print(` return result;`);
+ print(`}`);
+ }
+ }
+ print();
}
- print();
}
-
+
print(`uchar count_bits(uchar x) {`);
print(` return uchar(((x | uchar(1 << 0)) == 0 ? 0 : 1) +`);
for (let i = 1; i < 7; ++i) {
}
}
print();
-
+
print(`uint firstbithigh(uchar x) {`);
for (let i = 0; i <= 7; ++i) {
print(` if ((x & uchar(1 << ${7 - i})) != 0)`);
}
}
print();
-
+
// Row-major, so the first index selects which row, and the second index selects which column
for (let type of [`half`, `float`]) {
print(`${type} determinant(${type} x) {`);
print(`}`);
}
print();
-
+
for (let type of [`uchar4`, `ushort4`, `uint4`, `char4`, `short4`, `int4`, `half4`, `float4`]) {
print(`${type} dst(${type} src0, ${type} src1) {`);
print(` ${type} result;`);
print(`}`);
}
print();
-
+
for (let type of [`half`, `float`]) {
print(`${type} distance(${type} x, ${type} y) {`);
print(` return length(x - y);`);
}
}
print();
-
+
for (let type of [`half3`, `float3`]) {
print(`${type} cross(${type} u, ${type} v) {`);
print(` ${type} result;`);
print(`}`);
}
print();
-
+
for (let type of [`uchar`, `ushort`, `uint`, `char`, `short`, `int`, `half`, `float`]) {
print(`${type} dot(${type} a, ${type} b) {`);
print(` return a * b;`);
}
}
print();
-
+
for (let type of [`half`, `float`]) {
for (let size of [``, `2`, `3`, `4`]) {
print(`${type}${size} faceforward(${type}${size} n, ${type}${size} i, ${type}${size} ng) {`);
}
}
print();
-
+
for (let type of [`half`, `float`]) {
for (let size of [``, `2`, `3`, `4`]) {
print(`${type} length(${type}${size} x) {`);
}
}
print();
-
+
for (let type of [`half`, `float`]) {
print(`${type}4 lit(${type} n_dot_l, ${type} n_dot_h, ${type} m) {`);
print(` ${type} ambient = 1;`);
print(`}`);
}
print();
-
+
for (let type of [`half`, `float`]) {
for (let size of [``, `2`, `3`, `4`]) {
print(`${type}${size} normalize(${type}${size} x) {`);
}
}
print();
-
+
for (let type of [`half`, `float`]) {
for (let size of [``, `2`, `3`, `4`]) {
print(`${type}${size} reflect(${type}${size} i, ${type}${size} n) {`);
}
}
print();
-
+
// OpenGL ES v3.30 section 8.4
for (let type of [`half`, `float`]) {
for (let size of [``, `2`, `3`, `4`]) {
}
}
print();
-
+
for (let type of [`half`, `float`]) {
print(`${type} transpose(${type} x) {`);
print(` return x;`);
}
}
print();
-
+
for (let resultType of [`int`, `uint`, `float`]) {
for (let type of [`int`, `uint`, `float`]) {
if (type == resultType) {
}
}
print();
-
+
print(`native float f16tof32(uint);`);
print(`native uint f32tof16(float);`);
for (let size of [2, 3, 4]) {
print(`}`);
}
print();
-
+
print(`native compute void AllMemoryBarrierWithGroupSync();`);
print(`native compute void DeviceMemoryBarrierWithGroupSync();`);
print(`native compute void GroupMemoryBarrierWithGroupSync();`);
print();
-
+
for (let type of [`uchar`, `ushort`, `uint`, `char`, `short`, `int`, `half`, `float`]) {
print(`${type} mul(${type} x, ${type} y) {`);
print(` return x * y;`);
print(`}`);
}
-
+
for (let type of [`uchar`, `ushort`, `uint`, `char`, `short`, `int`, `half`, `float`]) {
for (let size of [2, 3, 4]) {
print(`${type}${size} mul(${type} x, ${type}${size} y) {`);
print(`}`);
}
}
-
+
for (let type of [`half`, `float`]) {
for (let i of [2, 3, 4]) {
for (let j of [2, 3, 4]) {
}
}
}
-
+
for (let type of [`uchar`, `ushort`, `uint`, `char`, `short`, `int`, `half`, `float`]) {
for (let size of [2, 3, 4]) {
print(`${type} mul(${type}${size} x, ${type}${size} y) {`);
print(`}`);
}
}
-
+
for (let type of [`half`, `float`]) {
for (let i of [2, 3, 4]) {
for (let j of [2, 3, 4]) {
}
}
}
-
+
for (let type of [`half`, `float`]) {
for (let i of [2, 3, 4]) {
for (let j of [2, 3, 4]) {
}
print();
- for (let type of [`uint`, `int`]) {
- for (let functionName of [`Add`, `And`, `Exchange`, `Max`, `Min`, `Or`, `Xor`]) {
- print(`native void Interlocked${functionName}(thread atomic_${type}*, ${type}, thread ${type}*);`);
- print(`native void Interlocked${functionName}(threadgroup atomic_${type}*, ${type}, thread ${type}*);`);
- print(`native void Interlocked${functionName}(device atomic_${type}*, ${type}, thread ${type}*);`);
+ for (let addressSpace1 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace2 of [`thread`, `device`, `threadgroup`]) {
+ for (let type of [`uint`, `int`]) {
+ for (let functionName of [`Add`, `And`, `Exchange`, `Max`, `Min`, `Or`, `Xor`])
+ print(`native void Interlocked${functionName}(${addressSpace1} atomic_${type}*, ${type}, ${addressSpace2} ${type}*);`);
+ print(`native void InterlockedCompareExchange(${addressSpace1} atomic_${type}*, ${type}, ${type}, ${addressSpace2} ${type}*);`);
+ }
}
- print(`native void InterlockedCompareExchange(thread atomic_${type}*, ${type}, ${type}, thread ${type}*);`);
- print(`native void InterlockedCompareExchange(threadgroup atomic_${type}*, ${type}, ${type}, thread ${type}*);`);
- print(`native void InterlockedCompareExchange(device atomic_${type}*, ${type}, ${type}, thread ${type}*);`);
}
print();
print(`native ${type}${length} Sample(Texture1D<${type}${length}>, sampler, float location, int offset);`);
print(`native ${type}${length} Load(Texture1D<${type}${length}>, int2 location);`);
print(`native ${type}${length} Load(Texture1D<${type}${length}>, int2 location, int offset);`);
- print(`native void GetDimensions(Texture1D<${type}${length}>, uint MipLevel, thread uint* Width, thread uint* NumberOfLevels);`);
+ for (let addressSpace1 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace2 of [`thread`, `device`, `threadgroup`])
+ print(`native void GetDimensions(Texture1D<${type}${length}>, uint MipLevel, ${addressSpace1} uint* Width, ${addressSpace2} uint* NumberOfLevels);`);
+ }
print();
print(`native ${type}${length} Sample(Texture1DArray<${type}${length}>, sampler, float2 location);`);
print(`native ${type}${length} Sample(Texture1DArray<${type}${length}>, sampler, float2 location, int offset);`);
print(`native ${type}${length} Load(Texture1DArray<${type}${length}>, int3 location);`);
print(`native ${type}${length} Load(Texture1DArray<${type}${length}>, int3 location, int offset);`);
- print(`native void GetDimensions(Texture1DArray<${type}${length}>, uint MipLevel, thread uint* Width, thread uint* Elements, thread uint* NumberOfLevels);`);
+ for (let addressSpace1 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace2 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace3 of [`thread`, `device`, `threadgroup`])
+ print(`native void GetDimensions(Texture1DArray<${type}${length}>, uint MipLevel, ${addressSpace1} uint* Width, ${addressSpace2} uint* Elements, ${addressSpace3} uint* NumberOfLevels);`);
+ }
+ }
print();
print(`native ${type}${length} Sample(Texture2D<${type}${length}>, sampler, float2 location);`);
print(`native ${type}${length} Sample(Texture2D<${type}${length}>, sampler, float2 location, int2 offset);`);
}
print(`native ${type}${length} Load(Texture2D<${type}${length}>, int3 location);`);
print(`native ${type}${length} Load(Texture2D<${type}${length}>, int3 location, int2 offset);`);
- print(`native void GetDimensions(Texture2D<${type}${length}>, uint MipLevel, thread uint* Width, thread uint* Height, thread uint* NumberOfLevels);`);
+ for (let addressSpace1 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace2 of [`thread`, `device`, `threadgroup`])
+ for (let addressSpace3 of [`thread`, `device`, `threadgroup`]) {
+ print(`native void GetDimensions(Texture2D<${type}${length}>, uint MipLevel, ${addressSpace1} uint* Width, ${addressSpace2} uint* Height, ${addressSpace3} uint* NumberOfLevels);`);
+ }
+ }
print();
print(`native ${type}${length} Sample(Texture2DArray<${type}${length}>, sampler, float3 location);`);
print(`native ${type}${length} Sample(Texture2DArray<${type}${length}>, sampler, float3 location, int2 offset);`);
}
print(`native ${type}${length} Load(Texture2DArray<${type}${length}>, int4 location);`);
print(`native ${type}${length} Load(Texture2DArray<${type}${length}>, int4 location, int2 offset);`);
- print(`native void GetDimensions(Texture2DArray<${type}${length}>, uint MipLevel, thread uint* Width, thread uint* Height, thread uint* Elements, thread uint* NumberOfLevels);`);
+ for (let addressSpace1 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace2 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace3 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace4 of [`thread`, `device`, `threadgroup`])
+ print(`native void GetDimensions(Texture2DArray<${type}${length}>, uint MipLevel, ${addressSpace1} uint* Width, ${addressSpace2} uint* Height, ${addressSpace3} uint* Elements, ${addressSpace4} uint* NumberOfLevels);`);
+ }
+ }
+ }
print();
print(`native ${type}${length} Sample(Texture3D<${type}${length}>, sampler, float3 location);`);
print(`native ${type}${length} Sample(Texture3D<${type}${length}>, sampler, float3 location, int3 offset);`);
print(`native ${type}${length} Load(Texture3D<${type}${length}>, int4 location);`);
print(`native ${type}${length} Load(Texture3D<${type}${length}>, int4 location, int3 offset);`);
- print(`native void GetDimensions(Texture3D<${type}${length}>, uint MipLevel, thread uint* Width, thread uint* Height, thread uint* Depth, thread uint* NumberOfLevels);`);
+ for (let addressSpace1 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace2 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace3 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace4 of [`thread`, `device`, `threadgroup`])
+ print(`native void GetDimensions(Texture3D<${type}${length}>, uint MipLevel, ${addressSpace1} uint* Width, ${addressSpace2} uint* Height, ${addressSpace3} uint* Depth, ${addressSpace4} uint* NumberOfLevels);`);
+ }
+ }
+ }
print();
print(`native ${type}${length} Sample(TextureCube<${type}${length}>, sampler, float3 location);`);
print(`native ${type}${length} SampleBias(TextureCube<${type}${length}>, sampler, float3 location, float Bias);`);
print(`native ${type}4 GatherAlpha(TextureCube<${type}${length}>, sampler, float3 location);`);
}
}
- print(`native void GetDimensions(TextureCube<${type}${length}>, uint MipLevel, thread uint* Width, thread uint* Height, thread uint* NumberOfLevels);`);
+ for (let addressSpace1 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace2 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace3 of [`thread`, `device`, `threadgroup`])
+ print(`native void GetDimensions(TextureCube<${type}${length}>, uint MipLevel, ${addressSpace1} uint* Width, ${addressSpace2} uint* Height, ${addressSpace3} uint* NumberOfLevels);`);
+ }
+ }
print();
- print(`native void GetDimensions(RWTexture1D<${type}${length}>, thread uint* Width);`);
- print(`native void GetDimensions(RWTexture1D<${type}${length}>, thread float* Width);`);
+ for (let addressSpace of [`thread`, `device`, `threadgroup`]) {
+ print(`native void GetDimensions(RWTexture1D<${type}${length}>, ${addressSpace} uint* Width);`);
+ print(`native void GetDimensions(RWTexture1D<${type}${length}>, ${addressSpace} float* Width);`);
+ }
print(`native ${type}${length} Load(RWTexture1D<${type}${length}>, int location);`);
print(`native void Store(RWTexture1D<${type}${length}>, ${type}${length}, uint location);`);
print();
- print(`native void GetDimensions(RWTexture1DArray<${type}${length}>, thread uint* Width, thread uint* Elements);`);
- print(`native void GetDimensions(RWTexture1DArray<${type}${length}>, thread float* Width, thread uint* Elements);`);
+ for (let addressSpace1 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace2 of [`thread`, `device`, `threadgroup`]) {
+ print(`native void GetDimensions(RWTexture1DArray<${type}${length}>, ${addressSpace1} uint* Width, ${addressSpace2} uint* Elements);`);
+ print(`native void GetDimensions(RWTexture1DArray<${type}${length}>, ${addressSpace1} float* Width, ${addressSpace2} uint* Elements);`);
+ }
+ }
print(`native ${type}${length} Load(RWTexture1DArray<${type}${length}>, int2 location);`);
print(`native void Store(RWTexture1DArray<${type}${length}>, ${type}${length}, uint2 location);`);
print();
- print(`native void GetDimensions(RWTexture2D<${type}${length}>, thread uint* Width, thread uint* Height);`);
- print(`native void GetDimensions(RWTexture2D<${type}${length}>, thread float* Width, thread float* Height);`);
+ for (let addressSpace1 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace2 of [`thread`, `device`, `threadgroup`]) {
+ print(`native void GetDimensions(RWTexture2D<${type}${length}>, ${addressSpace1} uint* Width, ${addressSpace2} uint* Height);`);
+ print(`native void GetDimensions(RWTexture2D<${type}${length}>, ${addressSpace1} float* Width, ${addressSpace2} float* Height);`);
+ }
+ }
print(`native ${type}${length} Load(RWTexture2D<${type}${length}>, int2 location);`);
print(`native void Store(RWTexture2D<${type}${length}>, ${type}${length}, uint2 location);`);
print();
- print(`native void GetDimensions(RWTexture2DArray<${type}${length}>, thread uint* Width, thread uint* Height, thread uint* Elements);`);
- print(`native void GetDimensions(RWTexture2DArray<${type}${length}>, thread float* Width, thread float* Height, thread float* Elements);`);
+ for (let addressSpace1 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace2 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace3 of [`thread`, `device`, `threadgroup`]) {
+ print(`native void GetDimensions(RWTexture2DArray<${type}${length}>, ${addressSpace1} uint* Width, ${addressSpace2} uint* Height, ${addressSpace3} uint* Elements);`);
+ print(`native void GetDimensions(RWTexture2DArray<${type}${length}>, ${addressSpace1} float* Width, ${addressSpace2} float* Height, ${addressSpace3} float* Elements);`);
+ }
+ }
+ }
print(`native ${type}${length} Load(RWTexture2DArray<${type}${length}>, int3 location);`);
print(`native void Store(RWTexture2DArray<${type}${length}>, ${type}${length}, uint3 location);`);
print();
- print(`native void GetDimensions(RWTexture3D<${type}${length}>, thread uint* Width, thread uint* Height, thread uint* Depth);`);
- print(`native void GetDimensions(RWTexture3D<${type}${length}>, thread float* Width, thread float* Height, thread float* Depth);`);
+ for (let addressSpace1 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace2 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace3 of [`thread`, `device`, `threadgroup`]) {
+ print(`native void GetDimensions(RWTexture3D<${type}${length}>, ${addressSpace1} uint* Width, ${addressSpace2} uint* Height, ${addressSpace3} uint* Depth);`);
+ print(`native void GetDimensions(RWTexture3D<${type}${length}>, ${addressSpace1} float* Width, ${addressSpace2} float* Height, ${addressSpace3} float* Depth);`);
+ }
+ }
+ }
print(`native ${type}${length} Load(RWTexture3D<${type}${length}>, int3 location);`);
print(`native void Store(RWTexture3D<${type}${length}>, ${type}${length}, uint3 location);`);
print();
print(`native ${type}4 GatherCmpRed(TextureDepth2D<${type}>, sampler, float2 location, float compare_value, int2 offset);`);
print(`native ${type} Load(TextureDepth2D<${type}>, int3 location);`);
print(`native ${type} Load(TextureDepth2D<${type}>, int3 location, int2 offset);`);
- print(`native void GetDimensions(TextureDepth2D<${type}>, uint MipLevel, thread uint* Width, thread uint* Height, thread uint* NumberOfLevels);`);
+ for (let addressSpace1 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace2 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace3 of [`thread`, `device`, `threadgroup`])
+ print(`native void GetDimensions(TextureDepth2D<${type}>, uint MipLevel, ${addressSpace1} uint* Width, ${addressSpace2} uint* Height, ${addressSpace3} uint* NumberOfLevels);`);
+ }
+ }
print();
print(`native ${type} Sample(TextureDepth2DArray<${type}>, sampler, float3 location);`);
print(`native ${type} Sample(TextureDepth2DArray<${type}>, sampler, float3 location, int2 offset);`);
print(`native ${type}4 GatherCmpRed(TextureDepth2DArray<${type}>, sampler, float3 location, float compare_value, int2 offset);`);
print(`native ${type} Load(TextureDepth2DArray<${type}>, int4 location);`);
print(`native ${type} Load(TextureDepth2DArray<${type}>, int4 location, int2 offset);`);
- print(`native void GetDimensions(TextureDepth2DArray<${type}>, uint MipLevel, thread uint* Width, thread uint* Height, thread uint* Elements, thread uint* NumberOfLevels);`);
+ for (let addressSpace1 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace2 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace3 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace4 of [`thread`, `device`, `threadgroup`])
+ print(`native void GetDimensions(TextureDepth2DArray<${type}>, uint MipLevel, ${addressSpace1} uint* Width, ${addressSpace2} uint* Height, ${addressSpace3} uint* Elements, ${addressSpace4} uint* NumberOfLevels);`);
+ }
+ }
+ }
print();
print(`native ${type} Sample(TextureDepthCube<${type}>, sampler, float3 location);`);
print(`native ${type} SampleCmp(TextureDepthCube<${type}>, sampler, float3 location, ${type} CompareValue);`);
print(`native ${type}4 GatherRed(TextureDepthCube<${type}>, sampler, float3 location);`);
print(`native ${type}4 GatherCmp(TextureDepthCube<${type}>, sampler, float3 location, float compare_value);`);
print(`native ${type}4 GatherCmpRed(TextureDepthCube<${type}>, sampler, float3 location, float compare_value);`);
- print(`native void GetDimensions(TextureDepthCube<${type}>, uint MipLevel, thread uint* Width, thread uint* Height, thread uint* NumberOfLevels);`);
+ for (let addressSpace1 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace2 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace3 of [`thread`, `device`, `threadgroup`])
+ print(`native void GetDimensions(TextureDepthCube<${type}>, uint MipLevel, ${addressSpace1} uint* Width, ${addressSpace2} uint* Height, ${addressSpace3} uint* NumberOfLevels);`);
+ }
+ }
print();
- print(`native void GetDimensions(RWTextureDepth2D<${type}>, thread uint* Width, thread uint* Height);`);
- print(`native void GetDimensions(RWTextureDepth2D<${type}>, thread float* Width, thread float* Height);`);
+ for (let addressSpace1 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace2 of [`thread`, `device`, `threadgroup`]) {
+ print(`native void GetDimensions(RWTextureDepth2D<${type}>, ${addressSpace1} uint* Width, ${addressSpace2} uint* Height);`);
+ print(`native void GetDimensions(RWTextureDepth2D<${type}>, ${addressSpace1} float* Width, ${addressSpace2} float* Height);`);
+ }
+ }
print(`native ${type} Load(RWTextureDepth2D<${type}>, int2 location);`);
print(`native void Store(RWTextureDepth2D<${type}>, ${type}, uint2 location);`);
print();
- print(`native void GetDimensions(RWTextureDepth2DArray<${type}>, thread uint* Width, thread uint* Height, thread uint* Elements);`);
- print(`native void GetDimensions(RWTextureDepth2DArray<${type}>, thread float* Width, thread float* Height, thread float* Elements);`);
+ for (let addressSpace1 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace2 of [`thread`, `device`, `threadgroup`]) {
+ for (let addressSpace3 of [`thread`, `device`, `threadgroup`]) {
+ print(`native void GetDimensions(RWTextureDepth2DArray<${type}>, ${addressSpace1} uint* Width, ${addressSpace2} uint* Height, ${addressSpace3} uint* Elements);`);
+ print(`native void GetDimensions(RWTextureDepth2DArray<${type}>, ${addressSpace1} float* Width, ${addressSpace2} float* Height, ${addressSpace3} float* Elements);`);
+ }
+ }
+ }
print(`native ${type} Load(RWTextureDepth2DArray<${type}>, int3 location);`);
print(`native void Store(RWTextureDepth2DArray<${type}>, ${type}, uint3 location);`);
print();