mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-02 02:08:12 +08:00
Switch shader texture usage from sampler2D to texture2D plus sampler (fixes #1)
This commit is contained in:
Vendored
+5
-2
@@ -7,7 +7,7 @@
|
|||||||
{
|
{
|
||||||
"type": "lldb",
|
"type": "lldb",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"name": "Debug executable 'graphite'",
|
"name": "Graphite debug executable",
|
||||||
"cargo": {
|
"cargo": {
|
||||||
"args": [
|
"args": [
|
||||||
"build",
|
"build",
|
||||||
@@ -20,7 +20,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"args": [],
|
"args": [],
|
||||||
"cwd": "${workspaceFolder}"
|
"cwd": "${workspaceFolder}",
|
||||||
|
"env": {
|
||||||
|
"RUST_LOG": "error"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "lldb",
|
"type": "lldb",
|
||||||
|
|||||||
Generated
+49
@@ -80,6 +80,17 @@ version = "0.3.5"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3c86699c3f02778ec07158376991c8f783dd1f2f95c579ffaf0738dc984b2fe2"
|
checksum = "3c86699c3f02778ec07158376991c8f783dd1f2f95c579ffaf0738dc984b2fe2"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "atty"
|
||||||
|
version = "0.2.14"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
||||||
|
dependencies = [
|
||||||
|
"hermit-abi",
|
||||||
|
"libc",
|
||||||
|
"winapi 0.3.8",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "autocfg"
|
name = "autocfg"
|
||||||
version = "0.1.7"
|
version = "0.1.7"
|
||||||
@@ -436,6 +447,19 @@ version = "1.5.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3"
|
checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "env_logger"
|
||||||
|
version = "0.7.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
|
||||||
|
dependencies = [
|
||||||
|
"atty",
|
||||||
|
"humantime",
|
||||||
|
"log",
|
||||||
|
"regex",
|
||||||
|
"termcolor",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "failure"
|
name = "failure"
|
||||||
version = "0.1.8"
|
version = "0.1.8"
|
||||||
@@ -799,6 +823,7 @@ dependencies = [
|
|||||||
"bytemuck",
|
"bytemuck",
|
||||||
"cgmath",
|
"cgmath",
|
||||||
"css-color-parser",
|
"css-color-parser",
|
||||||
|
"env_logger",
|
||||||
"failure",
|
"failure",
|
||||||
"futures",
|
"futures",
|
||||||
"glsl-to-spirv",
|
"glsl-to-spirv",
|
||||||
@@ -829,6 +854,15 @@ dependencies = [
|
|||||||
"atom",
|
"atom",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "humantime"
|
||||||
|
version = "1.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
|
||||||
|
dependencies = [
|
||||||
|
"quick-error",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "image"
|
name = "image"
|
||||||
version = "0.22.5"
|
version = "0.22.5"
|
||||||
@@ -1384,6 +1418,12 @@ dependencies = [
|
|||||||
"unicode-xid 0.2.0",
|
"unicode-xid 0.2.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quick-error"
|
||||||
|
version = "1.2.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "0.6.13"
|
version = "0.6.13"
|
||||||
@@ -1816,6 +1856,15 @@ dependencies = [
|
|||||||
"winapi 0.3.8",
|
"winapi 0.3.8",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "termcolor"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f"
|
||||||
|
dependencies = [
|
||||||
|
"winapi-util",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thread_local"
|
name = "thread_local"
|
||||||
version = "1.0.1"
|
version = "1.0.1"
|
||||||
|
|||||||
+5
-1
@@ -19,4 +19,8 @@ bytemuck = "1.2.0"
|
|||||||
rctree = "0.3.3"
|
rctree = "0.3.3"
|
||||||
xmlparser = "0.13.1"
|
xmlparser = "0.13.1"
|
||||||
regex = "1.3.7"
|
regex = "1.3.7"
|
||||||
css-color-parser = "0.1.2"
|
css-color-parser = "0.1.2"
|
||||||
|
env_logger = { version = "0.7.1", optional = true }
|
||||||
|
|
||||||
|
[features]
|
||||||
|
debug = ["env_logger"]
|
||||||
|
|||||||
+4
-2
@@ -16,8 +16,10 @@ layout(set=0, binding=0) uniform GuiNodeUniform {
|
|||||||
vec4 border_color;
|
vec4 border_color;
|
||||||
vec4 fill_color;
|
vec4 fill_color;
|
||||||
};
|
};
|
||||||
layout(set=0, binding=1) uniform sampler2D t_texture;
|
|
||||||
|
layout(set=0, binding=1) uniform texture2D t_texture;
|
||||||
|
layout(set=0, binding=2) uniform sampler s_texture;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
f_color = fill_color * texture(t_texture, v_uv / textureSize(t_texture, 0) * 100);
|
f_color = fill_color * texture(sampler2D(t_texture, s_texture), v_uv / textureSize(sampler2D(t_texture, s_texture), 0) * 500);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -5,6 +5,6 @@ layout(location=0) in vec2 a_position;
|
|||||||
layout(location=0) out vec2 v_uv;
|
layout(location=0) out vec2 v_uv;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
v_uv = a_position;
|
v_uv = (a_position + 1) / 2;
|
||||||
gl_Position = vec4(a_position, 0.0, 1.0);
|
gl_Position = vec4(a_position, 0.0, 1.0);
|
||||||
}
|
}
|
||||||
@@ -60,6 +60,7 @@ impl GuiNode {
|
|||||||
let bind_group = Pipeline::build_bind_group(device, &pipeline.bind_group_layout, vec![
|
let bind_group = Pipeline::build_bind_group(device, &pipeline.bind_group_layout, vec![
|
||||||
Pipeline::build_binding_resource(&binding_staging_buffer),
|
Pipeline::build_binding_resource(&binding_staging_buffer),
|
||||||
wgpu::BindingResource::TextureView(&texture.texture_view),
|
wgpu::BindingResource::TextureView(&texture.texture_view),
|
||||||
|
wgpu::BindingResource::Sampler(&texture.sampler),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
vec![
|
vec![
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ use winit::event_loop::EventLoop;
|
|||||||
use winit::window::WindowBuilder;
|
use winit::window::WindowBuilder;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
// Display graphics API errors (requires Vulkan SDK is installed)
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
|
env_logger::init();
|
||||||
|
|
||||||
// Handles all window events, user input, and redraws
|
// Handles all window events, user input, and redraws
|
||||||
let event_loop = EventLoop::new();
|
let event_loop = EventLoop::new();
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ impl Pipeline {
|
|||||||
component_type: wgpu::TextureComponentType::Float,
|
component_type: wgpu::TextureComponentType::Float,
|
||||||
multisampled: false,
|
multisampled: false,
|
||||||
},
|
},
|
||||||
|
wgpu::BindingType::Sampler { comparison: false },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Combine all bind group layouts
|
// Combine all bind group layouts
|
||||||
|
|||||||
Reference in New Issue
Block a user