Browse Source

i need to think about what i'm doing for a bit

main
Thomas Johnson 6 months ago
parent
commit
9589b15be2
  1. 45
      src/map/shader.glsl
  2. 1
      src/transform.rs

45
src/map/shader.glsl

@ -1,4 +1,49 @@
#version 450
#extension GL_EXT_shader_explicit_arithmetic_types: require
#extension GL_KHR_shader_subgroup_arithmetic: require
in;
struct ImageFormat {
uint32_t channel_stride;
uint32_t width;
uint32_t width_stride;
uint32_t height;
uint32_t height_stride;
};
layout(set = 0, binding = 0) buffer ImF {
ImageFormat image_format;
};
layout(set = 0, binding = 1) buffer GoalImage
{
float goal_image[];
};
struct Transform {
f32mat3 color_matrix;
u32vec2 from_corner;
u32vec2 from_extents;
f32vec2 to_corner;
f32mat2 to_extents;
};
layout(set = 0, binding = 2) buffer Tfs {
Transform transforms[];
};
uvec3 get_pixel_offsets(uint x, uint y) {
uint base_offset = x * image_format.width_stride + y * image_format.height_stride;
return uvec3(base_offset, base_offset + image_format.channel_stride, base_offset + image_format.channel_stride + image_format.channel_stride);
}
vec3 get_goal_pixel(uint x, uint y) {
uvec3 offsets = get_pixel_offsets(x, y);
return vec3(goal_image[offsets.x], goal_image[offsets.y], goal_image[offsets.z]);
}
void main() {
}

1
src/transform.rs

@ -3,6 +3,7 @@ use image::{Rgb, GenericImage};
pub const NCOLORS: usize = 3;
#[derive(Debug, Clone)]
#[repr(C)]
pub struct Transform {
pub color_matrix: [f32; NCOLORS * NCOLORS],
// TODO: make these f32s

Loading…
Cancel
Save