@@ -71,12 +71,12 @@ static f32x4 wrap(f32x4 value, GPU::TextureWrapMode mode, f32x4 num_texels)
71
71
}
72
72
}
73
73
74
- ALWAYS_INLINE static Vector4<f32x4> texel4 (Image const & image, u32x4 level, u32x4 x, u32x4 y, u32x4 z )
74
+ ALWAYS_INLINE static Vector4<f32x4> texel4 (Image const & image, u32x4 level, u32x4 x, u32x4 y)
75
75
{
76
- auto const & t0 = image.texel (level[0 ], x[0 ], y[0 ], z[ 0 ] );
77
- auto const & t1 = image.texel (level[1 ], x[1 ], y[1 ], z[ 1 ] );
78
- auto const & t2 = image.texel (level[2 ], x[2 ], y[2 ], z[ 2 ] );
79
- auto const & t3 = image.texel (level[3 ], x[3 ], y[3 ], z[ 3 ] );
76
+ auto const & t0 = image.texel (level[0 ], x[0 ], y[0 ], 0 );
77
+ auto const & t1 = image.texel (level[1 ], x[1 ], y[1 ], 0 );
78
+ auto const & t2 = image.texel (level[2 ], x[2 ], y[2 ], 0 );
79
+ auto const & t3 = image.texel (level[3 ], x[3 ], y[3 ], 0 );
80
80
81
81
return Vector4<f32x4> {
82
82
f32x4 { t0.x (), t1.x (), t2.x (), t3.x () },
@@ -86,14 +86,14 @@ ALWAYS_INLINE static Vector4<f32x4> texel4(Image const& image, u32x4 level, u32x
86
86
};
87
87
}
88
88
89
- ALWAYS_INLINE static Vector4<f32x4> texel4border (Image const & image, u32x4 level, u32x4 x, u32x4 y, u32x4 z, FloatVector4 const & border, u32x4 w, u32x4 h)
89
+ ALWAYS_INLINE static Vector4<f32x4> texel4border (Image const & image, u32x4 level, u32x4 x, u32x4 y, FloatVector4 const & border, u32x4 w, u32x4 h)
90
90
{
91
91
auto border_mask = maskbits (x < 0 || x >= w || y < 0 || y >= h);
92
92
93
- auto const & t0 = (border_mask & 1 ) > 0 ? border : image.texel (level[0 ], x[0 ], y[0 ], z[ 0 ] );
94
- auto const & t1 = (border_mask & 2 ) > 0 ? border : image.texel (level[1 ], x[1 ], y[1 ], z[ 1 ] );
95
- auto const & t2 = (border_mask & 4 ) > 0 ? border : image.texel (level[2 ], x[2 ], y[2 ], z[ 2 ] );
96
- auto const & t3 = (border_mask & 8 ) > 0 ? border : image.texel (level[3 ], x[3 ], y[3 ], z[ 3 ] );
93
+ auto const & t0 = (border_mask & 1 ) > 0 ? border : image.texel (level[0 ], x[0 ], y[0 ], 0 );
94
+ auto const & t1 = (border_mask & 2 ) > 0 ? border : image.texel (level[1 ], x[1 ], y[1 ], 0 );
95
+ auto const & t2 = (border_mask & 4 ) > 0 ? border : image.texel (level[2 ], x[2 ], y[2 ], 0 );
96
+ auto const & t3 = (border_mask & 8 ) > 0 ? border : image.texel (level[3 ], x[3 ], y[3 ], 0 );
97
97
98
98
return Vector4<f32x4> {
99
99
f32x4 { t0.x (), t1.x (), t2.x (), t3.x () },
@@ -180,12 +180,11 @@ Vector4<AK::SIMD::f32x4> Sampler::sample_2d_lod(Vector2<AK::SIMD::f32x4> const&
180
180
if (filter == GPU::TextureFilter::Nearest) {
181
181
u32x4 i = to_u32x4 (u);
182
182
u32x4 j = to_u32x4 (v);
183
- u32x4 k = expand4 (0u );
184
183
185
184
i = image.width_is_power_of_two () ? i & width_mask : i % width;
186
185
j = image.height_is_power_of_two () ? j & height_mask : j % height;
187
186
188
- return texel4 (image, level, i, j, k );
187
+ return texel4 (image, level, i, j);
189
188
}
190
189
191
190
u -= 0 .5f ;
@@ -216,20 +215,18 @@ Vector4<AK::SIMD::f32x4> Sampler::sample_2d_lod(Vector2<AK::SIMD::f32x4> const&
216
215
}
217
216
}
218
217
219
- u32x4 k = expand4 (0u );
220
-
221
218
Vector4<f32x4> t0, t1, t2, t3;
222
219
223
220
if (m_config.texture_wrap_u == GPU::TextureWrapMode::Repeat && m_config.texture_wrap_v == GPU::TextureWrapMode::Repeat) {
224
- t0 = texel4 (image, level, i0, j0, k );
225
- t1 = texel4 (image, level, i1, j0, k );
226
- t2 = texel4 (image, level, i0, j1, k );
227
- t3 = texel4 (image, level, i1, j1, k );
221
+ t0 = texel4 (image, level, i0, j0);
222
+ t1 = texel4 (image, level, i1, j0);
223
+ t2 = texel4 (image, level, i0, j1);
224
+ t3 = texel4 (image, level, i1, j1);
228
225
} else {
229
- t1 = texel4border (image, level, i1 , j0, k , m_config.border_color , width, height);
230
- t0 = texel4border (image, level, i0 , j0, k , m_config.border_color , width, height);
231
- t2 = texel4border (image, level, i0, j1, k, m_config.border_color , width, height);
232
- t3 = texel4border (image, level, i1, j1, k, m_config.border_color , width, height);
226
+ t0 = texel4border (image, level, i0 , j0, m_config.border_color , width, height);
227
+ t1 = texel4border (image, level, i1 , j0, m_config.border_color , width, height);
228
+ t2 = texel4border (image, level, i0, j1, m_config.border_color , width, height);
229
+ t3 = texel4border (image, level, i1, j1, m_config.border_color , width, height);
233
230
}
234
231
235
232
f32x4 const alpha = frac_int_range (u);
0 commit comments