mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-17 05:49:30 -07:00
Runtime target textures seem to need to be the same format as the canvas current texture. Requires additional investigation.
Created a computeToTexture shader to experiment with writing directly to textures as a means of performing post processing.
This commit is contained in:
@@ -27,6 +27,14 @@ const loadTexture = async (device, url) => {
|
||||
return texture;
|
||||
};
|
||||
|
||||
const createRTT = (adapter, device, canvasContext) => {
|
||||
return device.createTexture({
|
||||
size: [...getCanvasSize(canvasContext.canvas), 1],
|
||||
format: canvasContext.getPreferredFormat(adapter),
|
||||
usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_SRC | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT// TODO: reduce
|
||||
});
|
||||
};
|
||||
|
||||
const loadShaderModule = async (device, url) => {
|
||||
const response = await fetch(url);
|
||||
const code = await response.text();
|
||||
@@ -46,4 +54,4 @@ const makeUniformBuffer = (device, structLayout, values = null) => {
|
||||
return buffer;
|
||||
};
|
||||
|
||||
export { getCanvasSize, loadTexture, loadShaderModule, makeUniformBuffer };
|
||||
export { getCanvasSize, loadTexture, createRTT, loadShaderModule, makeUniformBuffer };
|
||||
|
||||
Reference in New Issue
Block a user