Try disabling multisampling again

This commit is contained in:
ice_iix 2020-12-26 20:25:24 -08:00
parent 0953cc2871
commit b908e8667e
2 changed files with 22 additions and 37 deletions

View File

@ -39,9 +39,6 @@ use std::thread;
const ATLAS_SIZE: usize = 1024;
// TEMP
const NUM_SAMPLES: i32 = 2;
pub struct Camera {
pub pos: cgmath::Point3<f64>,
pub yaw: f64,
@ -775,7 +772,6 @@ init_shader! {
required accum => "taccum",
required revealage => "trevealage",
required color => "tcolor",
required samples => "samples",
},
}
}
@ -848,38 +844,35 @@ impl TransInfo {
main.bind();
let fb_color = gl::Texture::new();
fb_color.bind(gl::TEXTURE_2D_MULTISAMPLE);
fb_color.image_2d_sample(
gl::TEXTURE_2D_MULTISAMPLE,
NUM_SAMPLES,
fb_color.bind(gl::TEXTURE_2D);
fb_color.image_2d(
gl::TEXTURE_2D,
0,
width,
height,
gl::RGBA8,
false,
);
main.texture_2d(
gl::COLOR_ATTACHMENT_0,
gl::TEXTURE_2D_MULTISAMPLE,
&fb_color,
0,
gl::RGBA,
gl::UNSIGNED_BYTE,
None,
);
fb_color.set_parameter(gl::TEXTURE_2D, gl::TEXTURE_MIN_FILTER, gl::LINEAR);
fb_color.set_parameter(gl::TEXTURE_2D, gl::TEXTURE_MAG_FILTER, gl::LINEAR);
main.texture_2d(gl::COLOR_ATTACHMENT_0, gl::TEXTURE_2D, &fb_color, 0);
let fb_depth = gl::Texture::new();
fb_depth.bind(gl::TEXTURE_2D_MULTISAMPLE);
fb_depth.image_2d_sample(
gl::TEXTURE_2D_MULTISAMPLE,
NUM_SAMPLES,
fb_depth.bind(gl::TEXTURE_2D);
fb_depth.image_2d(
gl::TEXTURE_2D,
0,
width,
height,
gl::DEPTH_COMPONENT24,
false,
);
main.texture_2d(
gl::DEPTH_ATTACHMENT,
gl::TEXTURE_2D_MULTISAMPLE,
&fb_depth,
0,
gl::DEPTH_COMPONENT,
gl::FLOAT,
None,
);
fb_depth.set_parameter(gl::TEXTURE_2D, gl::TEXTURE_MIN_FILTER, gl::LINEAR);
fb_depth.set_parameter(gl::TEXTURE_2D, gl::TEXTURE_MAG_FILTER, gl::LINEAR);
main.texture_2d(gl::DEPTH_ATTACHMENT, gl::TEXTURE_2D, &fb_depth, 0);
gl::check_framebuffer_status();
gl::unbind_framebuffer();
@ -929,7 +922,6 @@ impl TransInfo {
shader.accum.set_int(0);
shader.revealage.set_int(1);
shader.color.set_int(2);
shader.samples.set_int(NUM_SAMPLES);
self.array.bind();
gl::draw_arrays(gl::TRIANGLES, 0, 6);
}

View File

@ -1,8 +1,6 @@
uniform sampler2D taccum;
uniform sampler2D trevealage;
uniform sampler2DMS tcolor;
uniform int samples;
uniform sampler2D tcolor;
out vec4 fragColor;
@ -12,11 +10,6 @@ void main() {
float aa = texelFetch(trevealage, C, 0).r;
vec4 col = texelFetch(tcolor, C, 0);
for (int i = 1; i < samples; i++) {
col += texelFetch(tcolor, C, i);
}
col /= float(samples);
float r = accum.a;
accum.a = aa;
if (r >= 1.0) {