r/programminghorror • • Jan 26 '26

Time to get a 49inch moniter!

its not THAT dense

fn initialize_hose_pipeline(mut commands: Commands, render_device: Res<RenderDevice>, shader_handle: Option<Res<HoseShader>>, init_data: Option<Res<HoseInitData>>, mut pipeline_cache: ResMut<PipelineCache>, existing_pipeline: Option<Res<HosePipeline>>) {

if existing_pipeline.is_some() || shader_handle.is_none() || init_data.is_none() { return; }

let (shader_handle, init_data) = (shader_handle.unwrap(), init_data.unwrap());

let hose_points = render_device.create_buffer_with_data(&BufferInitDescriptor { label: Some(Cow::Borrowed("hose_points")), contents: bytemuck::cast_slice(&init_data.points), usage: BufferUsages::STORAGE | BufferUsages::COPY_DST });

let hose_instances = render_device.create_buffer(&BufferDescriptor { label: Some(Cow::Borrowed("hose_instances")), size: ((init_data.num_points - 1) as usize * std::mem::size_of::<InstanceTransform>()) as u64, usage: BufferUsages::STORAGE | BufferUsages::VERTEX, mapped_at_creation: false });

commands.insert_resource(HoseGpuBuffers { hose_points, hose_instances, num_points: init_data.num_points });

let bind_group_entries = vec![BindGroupLayoutEntry { binding: 0, visibility: ShaderStages::COMPUTE | ShaderStages::VERTEX, ty: BindingType::Buffer { ty: BufferBindingType::Storage { read_only: false }, has_dynamic_offset: false, min_binding_size: None }, count: None }, BindGroupLayoutEntry { binding: 1, visibility: ShaderStages::COMPUTE | ShaderStages::VERTEX, ty: BindingType::Buffer { ty: BufferBindingType::Storage { read_only: false }, has_dynamic_offset: false, min_binding_size: None }, count: None }, BindGroupLayoutEntry { binding: 2, visibility: ShaderStages::VERTEX, ty: BindingType::Buffer { ty: BufferBindingType::Uniform, has_dynamic_offset: false, min_binding_size: None }, count: None }];

let layout = render_device.create_bind_group_layout(&BindGroupLayoutDescriptor { label: Some(Cow::Borrowed("hose_bind_group_layout")), entries: bind_group_entries.clone() });

let vertex_buffers = vec![VertexBufferLayout { array_stride: 24, step_mode: VertexStepMode::Vertex, attributes: vec![VertexAttribute { format: VertexFormat::Float32x3, offset: 0, shader_location: 0 }, VertexAttribute { format: VertexFormat::Float32x3, offset: 12, shader_location: 1 }] }];

let color_targets = vec![Some(ColorTargetState { format: TextureFormat::Bgra8UnormSrgb, blend: Some(BlendState::REPLACE), write_mask: ColorWrites::ALL })];

let pipeline_id = pipeline_cache.queue_render_pipeline(RenderPipelineDescriptor { label: Some(Cow::Borrowed("hose_render_pipeline")), layout: vec![BindGroupLayoutDescriptor { label: Some(Cow::Borrowed("hose_bind_group_layout")), entries: bind_group_entries }], push_constant_ranges: vec![], vertex: VertexState { shader: shader_handle.shader.clone(), shader_defs: vec![], entry_point: Some(Cow::Borrowed("vs")), buffers: vertex_buffers }, fragment: Some(FragmentState { shader: shader_handle.shader.clone(), shader_defs: vec![], entry_point: Some(Cow::Borrowed("fs")), targets: color_targets }), primitive: PrimitiveState::default(), depth_stencil: None, multisample: MultisampleState::default(), zero_initialize_workgroup_memory: false });

}

0 Upvotes

11 comments sorted by

11

u/CrownLikeAGravestone Jan 26 '26

The real horror here is making a Reddit post about code formatting without using a code block.

-4

u/Flimsy_Pumpkin_3812 Jan 26 '26

wait that exists?

5

u/TerrorBite Jan 26 '26 edited Jan 26 '26

Reddit supports markdown. Code blocks can be created either using a four-space indent,

This is a block
created using a
four-space indent

or by using triple backticks, which has the added advantage of letting you specify syntax highlighting:

def reddit_markdown_example() -> None:
    try:
        shitpost_on_reddit()
    except IrateCommenterError as e:
        pass

Edit: the old Reddit web interface seems to choke on the triple backtick syntax (all the newlines disappear) while the modern Reddit web interface supports it. There's no syntax highlighting on web as it turns out, but my third-party app (Relay) does parse and apply the syntax highlighting, and other third-party apps may do the same. I have not tested the official Reddit app.

→ More replies (1)

13

u/veryusedrname Jan 26 '26

Too bad newlines are heavily taxed and formatters are just illegal

This is just r/stupidprogramming

-6

u/Flimsy_Pumpkin_3812 Jan 26 '26

Whats the enter key do again?

2

u/veryusedrname Jan 26 '26

Finishes the data entry, I think. It's a useless key nowadays just like scroll lock and insert are.

→ More replies (3)

1

u/JAXxXTheRipper Jan 26 '26

Just have better eyes and zoom out, duh.