diff options
author | 2020-01-13 15:33:12 +0100 | |
---|---|---|
committer | 2020-02-25 13:26:50 +0100 | |
commit | 2f77a6bf5ac1b657c1f54ea0b589b1e115b95e6b (patch) | |
tree | 36ac71c22c829ce18c7197870943c9b9b8842d67 /wgpu/src/shader | |
parent | 8562a4c986ff48d478be794c8c4268047a9a57d7 (diff) | |
download | iced-2f77a6bf5ac1b657c1f54ea0b589b1e115b95e6b.tar.gz iced-2f77a6bf5ac1b657c1f54ea0b589b1e115b95e6b.tar.bz2 iced-2f77a6bf5ac1b657c1f54ea0b589b1e115b95e6b.zip |
Use array of atlases instead of one growing indefinitely.
Diffstat (limited to '')
-rw-r--r-- | wgpu/src/shader/image.frag | 6 | ||||
-rw-r--r-- | wgpu/src/shader/image.vert | 5 |
2 files changed, 6 insertions, 5 deletions
diff --git a/wgpu/src/shader/image.frag b/wgpu/src/shader/image.frag index e35e455a..2809e9e6 100644 --- a/wgpu/src/shader/image.frag +++ b/wgpu/src/shader/image.frag @@ -1,12 +1,12 @@ #version 450 -layout(location = 0) in vec2 v_Uv; +layout(location = 0) in vec3 v_Uv; layout(set = 0, binding = 1) uniform sampler u_Sampler; -layout(set = 1, binding = 0) uniform texture2D u_Texture; +layout(set = 1, binding = 0) uniform texture2DArray u_Texture; layout(location = 0) out vec4 o_Color; void main() { - o_Color = texture(sampler2D(u_Texture, u_Sampler), v_Uv); + o_Color = texture(sampler2DArray(u_Texture, u_Sampler), v_Uv); } diff --git a/wgpu/src/shader/image.vert b/wgpu/src/shader/image.vert index 953840d2..0ce7dd6b 100644 --- a/wgpu/src/shader/image.vert +++ b/wgpu/src/shader/image.vert @@ -5,15 +5,16 @@ layout(location = 1) in vec2 i_Pos; layout(location = 2) in vec2 i_Scale; layout(location = 3) in vec2 i_Atlas_Pos; layout(location = 4) in vec2 i_Atlas_Scale; +layout(location = 5) in float i_Layer; layout (set = 0, binding = 0) uniform Globals { mat4 u_Transform; }; -layout(location = 0) out vec2 o_Uv; +layout(location = 0) out vec3 o_Uv; void main() { - o_Uv = v_Pos * i_Atlas_Scale + i_Atlas_Pos; + o_Uv = vec3(v_Pos * i_Atlas_Scale + i_Atlas_Pos, i_Layer); mat4 i_Transform = mat4( vec4(i_Scale.x, 0.0, 0.0, 0.0), |