perf: remove shader checks
This commit is contained in:
+15
-10
@@ -126,16 +126,21 @@ pub struct BuddhabrotRenderer {
|
|||||||
|
|
||||||
impl BuddhabrotRenderer {
|
impl BuddhabrotRenderer {
|
||||||
pub fn new(device: &wgpu::Device, target_format: wgpu::TextureFormat) -> Self {
|
pub fn new(device: &wgpu::Device, target_format: wgpu::TextureFormat) -> Self {
|
||||||
let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor {
|
let shader = unsafe {
|
||||||
label: Some("buddhabrot"),
|
device.create_shader_module_trusted(
|
||||||
source: wgpu::ShaderSource::Wgsl(
|
wgpu::ShaderModuleDescriptor {
|
||||||
concat!(
|
label: Some("buddhabrot"),
|
||||||
include_str!("../shaders/common.wgsl"),
|
source: wgpu::ShaderSource::Wgsl(
|
||||||
include_str!("../shaders/buddhabrot.wgsl"),
|
concat!(
|
||||||
)
|
include_str!("../shaders/common.wgsl"),
|
||||||
.into(),
|
include_str!("../shaders/buddhabrot.wgsl"),
|
||||||
),
|
)
|
||||||
});
|
.into(),
|
||||||
|
),
|
||||||
|
},
|
||||||
|
wgpu::ShaderRuntimeChecks::unchecked(),
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
let uniform_buffer = device.create_buffer(&wgpu::BufferDescriptor {
|
let uniform_buffer = device.create_buffer(&wgpu::BufferDescriptor {
|
||||||
label: Some("buddhabrot uniforms"),
|
label: Some("buddhabrot uniforms"),
|
||||||
|
|||||||
+62
-42
@@ -197,16 +197,21 @@ struct Lipschitz {
|
|||||||
|
|
||||||
impl Lipschitz {
|
impl Lipschitz {
|
||||||
fn new(device: &wgpu::Device) -> Self {
|
fn new(device: &wgpu::Device) -> Self {
|
||||||
let module = device.create_shader_module(wgpu::ShaderModuleDescriptor {
|
let module = unsafe {
|
||||||
label: Some("lipschitz"),
|
device.create_shader_module_trusted(
|
||||||
source: wgpu::ShaderSource::Wgsl(
|
wgpu::ShaderModuleDescriptor {
|
||||||
concat!(
|
label: Some("lipschitz"),
|
||||||
include_str!("../shaders/common.wgsl"),
|
source: wgpu::ShaderSource::Wgsl(
|
||||||
include_str!("../shaders/lipschitz.wgsl"),
|
concat!(
|
||||||
)
|
include_str!("../shaders/common.wgsl"),
|
||||||
.into(),
|
include_str!("../shaders/lipschitz.wgsl"),
|
||||||
),
|
)
|
||||||
});
|
.into(),
|
||||||
|
),
|
||||||
|
},
|
||||||
|
wgpu::ShaderRuntimeChecks::unchecked(),
|
||||||
|
)
|
||||||
|
};
|
||||||
let texture_entry = |binding| wgpu::BindGroupLayoutEntry {
|
let texture_entry = |binding| wgpu::BindGroupLayoutEntry {
|
||||||
binding,
|
binding,
|
||||||
visibility: wgpu::ShaderStages::FRAGMENT,
|
visibility: wgpu::ShaderStages::FRAGMENT,
|
||||||
@@ -617,17 +622,22 @@ impl FractalRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(device: &wgpu::Device, target_format: wgpu::TextureFormat) -> Self {
|
pub fn new(device: &wgpu::Device, target_format: wgpu::TextureFormat) -> Self {
|
||||||
let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor {
|
let shader = unsafe {
|
||||||
label: Some("mandelbrot"),
|
device.create_shader_module_trusted(
|
||||||
source: wgpu::ShaderSource::Wgsl(
|
wgpu::ShaderModuleDescriptor {
|
||||||
concat!(
|
label: Some("mandelbrot"),
|
||||||
include_str!("../shaders/common.wgsl"),
|
source: wgpu::ShaderSource::Wgsl(
|
||||||
include_str!("../shaders/iterate_uniforms.wgsl"),
|
concat!(
|
||||||
include_str!("../shaders/mandelbrot.wgsl"),
|
include_str!("../shaders/common.wgsl"),
|
||||||
)
|
include_str!("../shaders/iterate_uniforms.wgsl"),
|
||||||
.into(),
|
include_str!("../shaders/mandelbrot.wgsl"),
|
||||||
),
|
)
|
||||||
});
|
.into(),
|
||||||
|
),
|
||||||
|
},
|
||||||
|
wgpu::ShaderRuntimeChecks::unchecked(),
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
let uniform_buffer = device.create_buffer(&wgpu::BufferDescriptor {
|
let uniform_buffer = device.create_buffer(&wgpu::BufferDescriptor {
|
||||||
label: Some("fractal uniforms"),
|
label: Some("fractal uniforms"),
|
||||||
@@ -748,17 +758,22 @@ impl FractalRenderer {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Colourise pass: data texture + colour uniforms → colour texture.
|
// Colourise pass: data texture + colour uniforms → colour texture.
|
||||||
let colorize_shader = device.create_shader_module(wgpu::ShaderModuleDescriptor {
|
let colorize_shader = unsafe {
|
||||||
label: Some("colorize"),
|
device.create_shader_module_trusted(
|
||||||
source: wgpu::ShaderSource::Wgsl(
|
wgpu::ShaderModuleDescriptor {
|
||||||
concat!(
|
label: Some("colorize"),
|
||||||
include_str!("../shaders/common.wgsl"),
|
source: wgpu::ShaderSource::Wgsl(
|
||||||
include_str!("../shaders/iterate_uniforms.wgsl"),
|
concat!(
|
||||||
include_str!("../shaders/colorize.wgsl"),
|
include_str!("../shaders/common.wgsl"),
|
||||||
)
|
include_str!("../shaders/iterate_uniforms.wgsl"),
|
||||||
.into(),
|
include_str!("../shaders/colorize.wgsl"),
|
||||||
),
|
)
|
||||||
});
|
.into(),
|
||||||
|
),
|
||||||
|
},
|
||||||
|
wgpu::ShaderRuntimeChecks::unchecked(),
|
||||||
|
)
|
||||||
|
};
|
||||||
let colorize_bind_group_layout =
|
let colorize_bind_group_layout =
|
||||||
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||||
label: Some("colorize bind group layout"),
|
label: Some("colorize bind group layout"),
|
||||||
@@ -829,16 +844,21 @@ impl FractalRenderer {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Blit pipeline: samples the cache texture onto egui's surface.
|
// Blit pipeline: samples the cache texture onto egui's surface.
|
||||||
let blit_shader = device.create_shader_module(wgpu::ShaderModuleDescriptor {
|
let blit_shader = unsafe {
|
||||||
label: Some("blit"),
|
device.create_shader_module_trusted(
|
||||||
source: wgpu::ShaderSource::Wgsl(
|
wgpu::ShaderModuleDescriptor {
|
||||||
concat!(
|
label: Some("blit"),
|
||||||
include_str!("../shaders/common.wgsl"),
|
source: wgpu::ShaderSource::Wgsl(
|
||||||
include_str!("../shaders/blit.wgsl"),
|
concat!(
|
||||||
)
|
include_str!("../shaders/common.wgsl"),
|
||||||
.into(),
|
include_str!("../shaders/blit.wgsl"),
|
||||||
),
|
)
|
||||||
});
|
.into(),
|
||||||
|
),
|
||||||
|
},
|
||||||
|
wgpu::ShaderRuntimeChecks::unchecked(),
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
let blit_bind_group_layout =
|
let blit_bind_group_layout =
|
||||||
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||||
|
|||||||
Reference in New Issue
Block a user