@@ -85,16 +85,21 @@ class ShapeSink {
8585 } else if (name == " g_LightsPosition" _str) {
8686 light_position_shape = shape;
8787 found_light_position = true ;
88+ } else if (name == " g_TextureReductionScale" _str) {
89+ texture_reduction_shape = shape;
90+ found_texture_reduction = true ;
8891 }
8992 return rstd::Ok (true );
9093 }
9194
9295 owe::UniformValueShape model_shape;
9396 owe::UniformValueShape spectrum_shape;
9497 owe::UniformValueShape light_position_shape;
98+ owe::UniformValueShape texture_reduction_shape;
9599 bool found_model { false };
96100 bool found_spectrum { false };
97101 bool found_light_position { false };
102+ bool found_texture_reduction { false };
98103};
99104
100105class UpdateContext {
@@ -434,6 +439,23 @@ TEST(ShadowUniformSource, UsesAuthoredCascadeExtentAndLightObjectFrame) {
434439 EXPECT_FLOAT_EQ (atlas[usize (8 )], 2 .0f / 3 .0f );
435440}
436441
442+ TEST (TextureUniformSource, PublishesUnreducedTextureScale) {
443+ owe::TextureUniformSource source;
444+ scene_test::ShapeSink binding_sink;
445+ auto bindings = rstd::dyn<owe::UniformBindingSink>::from_ref (binding_sink);
446+ ASSERT_TRUE (source.Describe (bindings.as_mut_ref ()).is_ok ());
447+ ASSERT_TRUE (binding_sink.found_texture_reduction );
448+ EXPECT_EQ (binding_sink.texture_reduction_shape .scalar , owe::UniformScalarType::Float32);
449+ EXPECT_EQ (binding_sink.texture_reduction_shape .kind , owe::UniformValueKind::Linear);
450+ EXPECT_EQ (binding_sink.texture_reduction_shape .min_elements , u32 (1 ));
451+ EXPECT_EQ (binding_sink.texture_reduction_shape .max_elements , u32 (1 ));
452+
453+ owe::SceneFrame frame;
454+ auto scale = scene_test::Capture (frame, source, owe::TextureUniformOutput::ReductionScale);
455+ ASSERT_EQ (scale.size (), usize (1 ));
456+ EXPECT_FLOAT_EQ (scale[usize ()], 1 .0f );
457+ }
458+
437459TEST (TextureUniformSource, StaticTextureUsesIdentityTransform) {
438460 owe::SceneFrame frame;
439461 scene_test::StaticTextureResources resources;
0 commit comments