mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-07-07 15:55:00 +00:00
Switch shader texture usage from sampler2D to texture2D plus sampler (fixes #1)
This commit is contained in:
parent
58992ba8ad
commit
642c7ffd00
8 changed files with 70 additions and 6 deletions
7
.vscode/launch.json
vendored
7
.vscode/launch.json
vendored
|
@ -7,7 +7,7 @@
|
|||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Debug executable 'graphite'",
|
||||
"name": "Graphite debug executable",
|
||||
"cargo": {
|
||||
"args": [
|
||||
"build",
|
||||
|
@ -20,7 +20,10 @@
|
|||
}
|
||||
},
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}"
|
||||
"cwd": "${workspaceFolder}",
|
||||
"env": {
|
||||
"RUST_LOG": "error"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
|
|
49
Cargo.lock
generated
49
Cargo.lock
generated
|
@ -80,6 +80,17 @@ version = "0.3.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
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]]
|
||||
name = "autocfg"
|
||||
version = "0.1.7"
|
||||
|
@ -436,6 +447,19 @@ version = "1.5.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
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]]
|
||||
name = "failure"
|
||||
version = "0.1.8"
|
||||
|
@ -799,6 +823,7 @@ dependencies = [
|
|||
"bytemuck",
|
||||
"cgmath",
|
||||
"css-color-parser",
|
||||
"env_logger",
|
||||
"failure",
|
||||
"futures",
|
||||
"glsl-to-spirv",
|
||||
|
@ -829,6 +854,15 @@ dependencies = [
|
|||
"atom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "humantime"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
|
||||
dependencies = [
|
||||
"quick-error",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "image"
|
||||
version = "0.22.5"
|
||||
|
@ -1384,6 +1418,12 @@ dependencies = [
|
|||
"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]]
|
||||
name = "quote"
|
||||
version = "0.6.13"
|
||||
|
@ -1816,6 +1856,15 @@ dependencies = [
|
|||
"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]]
|
||||
name = "thread_local"
|
||||
version = "1.0.1"
|
||||
|
|
|
@ -19,4 +19,8 @@ bytemuck = "1.2.0"
|
|||
rctree = "0.3.3"
|
||||
xmlparser = "0.13.1"
|
||||
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"]
|
||||
|
|
|
@ -16,8 +16,10 @@ layout(set=0, binding=0) uniform GuiNodeUniform {
|
|||
vec4 border_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() {
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,6 @@ layout(location=0) in vec2 a_position;
|
|||
layout(location=0) out vec2 v_uv;
|
||||
|
||||
void main() {
|
||||
v_uv = a_position;
|
||||
v_uv = (a_position + 1) / 2;
|
||||
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![
|
||||
Pipeline::build_binding_resource(&binding_staging_buffer),
|
||||
wgpu::BindingResource::TextureView(&texture.texture_view),
|
||||
wgpu::BindingResource::Sampler(&texture.sampler),
|
||||
]);
|
||||
|
||||
vec![
|
||||
|
|
|
@ -20,6 +20,10 @@ use winit::event_loop::EventLoop;
|
|||
use winit::window::WindowBuilder;
|
||||
|
||||
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
|
||||
let event_loop = EventLoop::new();
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ impl Pipeline {
|
|||
component_type: wgpu::TextureComponentType::Float,
|
||||
multisampled: false,
|
||||
},
|
||||
wgpu::BindingType::Sampler { comparison: false },
|
||||
]);
|
||||
|
||||
// Combine all bind group layouts
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue