The texture sampler should operate linearly

This commit is contained in:
Rezmason
2021-10-29 09:16:28 -07:00
parent 23d397fa11
commit fb6406e753
3 changed files with 12 additions and 3 deletions

View File

@@ -3,6 +3,7 @@ TODO:
WebGPU
First decent rainRender
vertex, fragment, with noise for
data texture lookup with textureLoad
std140
Document and share it

View File

@@ -68,7 +68,11 @@ export default async (canvas, config) => {
],
};
const sampler = device.createSampler();
const msdfSampler = device.createSampler({
magFilter: "linear",
minFilter: "linear",
});
const msdfTexture = await loadTexture(device, config.glyphTexURL);
const configStructLayout = std140(["i32", "i32", "f32"]);
@@ -176,7 +180,7 @@ export default async (canvas, config) => {
},
{
binding: 2,
resource: sampler,
resource: msdfSampler,
},
{
binding: 3,

View File

@@ -42,4 +42,8 @@ Bind groups let you bind a bunch of resources at once
Render bundles let you reissue commands
You can only use up to FOUR bind groups on your laptop's device!
Here's an annoying gotcha: uniform buffers are like classic UBOs, and have esoteric ("std140") layout requirements!
Here's an annoying gotcha: uniform buffers are like classic UBOs, and have esoteric ("std140") layout requirements!
Texture lookup in vertex shader
You can only sample textures in fragment stages
But you can use textureLoad anywhere to get a specific texel, no sampler needed