forked from StrafesNET/roblox-bot-player
fixes
This commit is contained in:
@@ -2,6 +2,21 @@ struct VertexOutput {
|
||||
@builtin(position) position: vec4<f32>,
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vs_main(@builtin(vertex_index) vertex_index: u32) -> VertexOutput {
|
||||
// hacky way to draw a large triangle
|
||||
let tmp1 = i32(vertex_index) / 2;
|
||||
let tmp2 = i32(vertex_index) & 1;
|
||||
var result:VertexOutput;
|
||||
result.position=vec4<f32>(
|
||||
f32(tmp1) * 4.0 - 1.0,
|
||||
f32(tmp2) * 4.0 - 1.0,
|
||||
1.0,
|
||||
1.0
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
@group(0)
|
||||
@binding(0)
|
||||
var texture: texture_2d<f32>;
|
||||
@@ -12,7 +27,7 @@ var texture_sampler: sampler;
|
||||
@fragment
|
||||
fn fs_main_y(input: VertexOutput) -> @location(0) f32 {
|
||||
let conversion_weights = vec3<f32>(0.2126, 0.7152, 0.0722);
|
||||
let color = textureSample(texture, texture_sampler, vertex.texture);
|
||||
let color = textureSample(texture, texture_sampler, input.position.xy).rgb;
|
||||
|
||||
return clamp(dot(color, conversion_weights), 0.0, 1.0);
|
||||
}
|
||||
@@ -25,7 +40,7 @@ fn fs_main_uv(input: VertexOutput) -> @location(0) vec2<f32> {
|
||||
0.5, -0.0458,
|
||||
);
|
||||
let conversion_bias = vec2<f32>(0.5, 0.5);
|
||||
let color = textureSample(texture, texture_sampler, vertex.texture);
|
||||
let color = textureSample(texture, texture_sampler, input.position.xy).rgb;
|
||||
|
||||
return clamp(conversion_weights * color + conversion_bias, vec2(0.0, 0.0), vec2(1.0, 1.0));
|
||||
}
|
||||
|
||||
@@ -141,13 +141,13 @@ impl WgpuState {
|
||||
mip_level_count:1,
|
||||
sample_count:1,
|
||||
dimension:wgpu::TextureDimension::D2,
|
||||
usage:wgpu::TextureUsages::RENDER_ATTACHMENT,
|
||||
usage:wgpu::TextureUsages::TEXTURE_BINDING,
|
||||
view_formats:&[],
|
||||
});
|
||||
let graphics_texture_view = graphics_texture.create_view(&wgpu::TextureViewDescriptor {
|
||||
label: Some("RGB texture view"),
|
||||
aspect: wgpu::TextureAspect::All,
|
||||
usage: Some(wgpu::TextureUsages::RENDER_ATTACHMENT),
|
||||
usage: Some(wgpu::TextureUsages::TEXTURE_BINDING),
|
||||
..Default::default()
|
||||
});
|
||||
let clamp_sampler=device.create_sampler(&wgpu::SamplerDescriptor{
|
||||
@@ -172,7 +172,7 @@ impl WgpuState {
|
||||
resource:wgpu::BindingResource::Sampler(&clamp_sampler),
|
||||
},
|
||||
],
|
||||
label:Some("Sky Texture"),
|
||||
label:Some("Graphics Texture"),
|
||||
});
|
||||
|
||||
let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
|
||||
Reference in New Issue
Block a user