Address review on 3573

This commit is contained in:
Imbris 2023-04-08 02:19:14 -04:00
parent 2a9a63a60e
commit 5881e44e61
4 changed files with 7 additions and 15 deletions

View File

@ -43,16 +43,6 @@ vec3 linear_to_srgb(vec3 col) {
);
}
vec4 srgba8_to_linear(uint srgba8) {
vec4 nonlinear = vec4(uvec4(
(srgba8 >> 24) & 0xFFu,
(srgba8 >> 16) & 0xFFu,
(srgba8 >> 8) & 0xFFu,
srgba8 & 0xFFu
)) / 255.0;
return vec4(srgb_to_linear(nonlinear.rgb), nonlinear.a);
}
float pow5(float x) {
float x2 = x * x;
return x2 * x2 * x;

View File

@ -13,7 +13,6 @@ uniform u_locals {
vec4 w_pos;
};
// TODO: swap with u_locals because that may change more frequently?
layout(set = 2, binding = 0)
uniform texture2D t_tex;
layout(set = 2, binding = 1)
@ -71,7 +70,7 @@ void downscale_params(float pos, float scale, out vec2 weights, out vec2 offsets
// 4 pixels (within a single dimension) in the sampled texture. So we can't
// perfectly compute the contribution of each covered pixel in the sampled
// texture with only 2 samples (along each dimension). Thus, we fallback to
// an imperfect technique of just sampling a 1 pixel length from the center
// an imperfect technique of just sampling 1 pixel length from the center
// on each side of the nearest pixel edge. An alternative might be to
// pre-compute mipmap levels that could be sampled from, although this
// could interact poorly with the atlas.

View File

@ -570,7 +570,8 @@ impl PremultiplyUpload {
// TODO: duplicating some code from `Texture` since:
// 1. We don't need to create a sampler.
// 2. Texture::new accepts &DynamicImage which isn't possible to create from
// &RgbaImage without cloning.
// &RgbaImage without cloning. (this might be addressed on zoomy worldgen
// branch)
let image_size = wgpu::Extent3d {
width: image.width(),
height: image.height(),

View File

@ -325,11 +325,13 @@ impl GraphicCache {
self.cache_map.drain_filter(|key, details| {
if key.graphic_id == id {
match details {
// TODO: if replace_graphic is used continously for small images (i.e.
// NOTE: if replace_graphic is used continously for small images (i.e.
// images placed into an atlas) of different sizes, that can use up our
// atlas space since spots in the atlas can't be reused. (this scenario is
// now possible with scaling being done during sampling rather than placing
// resized version into the atlas)
// resized version into the atlas). This is expected to not occur in all
// pratical cases we plan to support here (i.e. the size of the replacement
// image will always be the same).
CachedDetails::Atlas { .. } => {},
CachedDetails::Texture { index, .. } => {
self.textures.remove(*index);