Compare commits

..

No commits in common. "8bba7b9e1b1e60971be1fb9cf7cca4d68de3c3c4" and "b025f7260467b3ffffff400f17c1caf2a23197cf" have entirely different histories.

4 changed files with 3 additions and 56 deletions

15
Cargo.lock generated
View File

@ -220,20 +220,6 @@ name = "bytemuck"
version = "1.19.0" version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8334215b81e418a0a7bdb8ef0849474f40bb10c8b71f1c4ed315cff49f32494d" checksum = "8334215b81e418a0a7bdb8ef0849474f40bb10c8b71f1c4ed315cff49f32494d"
dependencies = [
"bytemuck_derive",
]
[[package]]
name = "bytemuck_derive"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcfcc3cd946cb52f0bbfdbbcfa2f4e24f75ebb6c0e1002f7c25904fada18b9ec"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.87",
]
[[package]] [[package]]
name = "bytes" name = "bytes"
@ -1503,7 +1489,6 @@ name = "shrooms-vb-native"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytemuck",
"cc", "cc",
"clap", "clap",
"imgui", "imgui",

View File

@ -5,7 +5,6 @@ edition = "2021"
[dependencies] [dependencies]
anyhow = "1" anyhow = "1"
bytemuck = { version = "1", features = ["derive"] }
clap = { version = "4", features = ["derive"] } clap = { version = "4", features = ["derive"] }
imgui = "0.12" imgui = "0.12"
imgui-wgpu = { git = "https://github.com/Yatekii/imgui-wgpu-rs", rev = "2edd348" } imgui-wgpu = { git = "https://github.com/Yatekii/imgui-wgpu-rs", rev = "2edd348" }

View File

@ -41,15 +41,9 @@ var u_texture: texture_2d<f32>;
@group(0) @binding(1) @group(0) @binding(1)
var u_sampler: sampler; var u_sampler: sampler;
struct Colors {
left: vec4<f32>,
right: vec4<f32>,
};
@group(0) @binding(2)
var<uniform> colors: Colors;
@fragment @fragment
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> { fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
let brt = textureSample(u_texture, u_sampler, in.tex_coords); return textureSample(u_texture, u_sampler, in.tex_coords);
return colors.left * brt[0] + colors.right * brt[1]; // return vec4<f32>(0.3, 0.2, 0.1, 1.0);
} }

View File

@ -3,7 +3,6 @@ use imgui_wgpu::{Renderer, RendererConfig};
use imgui_winit_support::WinitPlatform; use imgui_winit_support::WinitPlatform;
use pollster::block_on; use pollster::block_on;
use std::{sync::Arc, time::Instant}; use std::{sync::Arc, time::Instant};
use wgpu::util::DeviceExt as _;
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
use winit::platform::windows::{CornerPreference, WindowAttributesExtWindows as _}; use winit::platform::windows::{CornerPreference, WindowAttributesExtWindows as _};
use winit::{ use winit::{
@ -44,7 +43,7 @@ struct AppWindow {
impl AppWindow { impl AppWindow {
fn setup_gpu(event_loop: &ActiveEventLoop, client: &EmulatorClient) -> Self { fn setup_gpu(event_loop: &ActiveEventLoop, client: &EmulatorClient) -> Self {
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::PRIMARY.difference(wgpu::Backends::VULKAN), backends: wgpu::Backends::PRIMARY,
..Default::default() ..Default::default()
}); });
@ -80,15 +79,6 @@ impl AppWindow {
})); }));
let eyes = eyes.create_view(&wgpu::TextureViewDescriptor::default()); let eyes = eyes.create_view(&wgpu::TextureViewDescriptor::default());
let sampler = device.create_sampler(&wgpu::SamplerDescriptor::default()); let sampler = device.create_sampler(&wgpu::SamplerDescriptor::default());
let colors = Colors {
left: [1.0, 0.0, 0.0, 1.0],
right: [0.0, 0.7734375, 0.9375, 1.0],
};
let color_buf = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
label: Some("colors"),
contents: bytemuck::bytes_of(&colors),
usage: wgpu::BufferUsages::UNIFORM | wgpu::BufferUsages::COPY_DST,
});
let texture_bind_group_layout = let texture_bind_group_layout =
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
label: Some("texture bind group layout"), label: Some("texture bind group layout"),
@ -109,16 +99,6 @@ impl AppWindow {
ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering), ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering),
count: None, count: None,
}, },
wgpu::BindGroupLayoutEntry {
binding: 2,
visibility: wgpu::ShaderStages::FRAGMENT,
ty: wgpu::BindingType::Buffer {
ty: wgpu::BufferBindingType::Uniform,
has_dynamic_offset: false,
min_binding_size: None,
},
count: None,
},
], ],
}); });
let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor { let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
@ -133,10 +113,6 @@ impl AppWindow {
binding: 1, binding: 1,
resource: wgpu::BindingResource::Sampler(&sampler), resource: wgpu::BindingResource::Sampler(&sampler),
}, },
wgpu::BindGroupEntry {
binding: 2,
resource: color_buf.as_entire_binding(),
},
], ],
}); });
@ -462,10 +438,3 @@ impl ApplicationHandler for App {
); );
} }
} }
#[derive(Clone, Copy, bytemuck::Pod, bytemuck::Zeroable)]
#[repr(C)]
struct Colors {
left: [f32; 4],
right: [f32; 4],
}