Move OpenGL image format mapping
This commit is contained in:
@@ -84,6 +84,36 @@ void selects_texture_upload_type_from_internal_format(pp::tests::Harness& h)
|
||||
PP_EXPECT(h, pp::renderer::gl::texture_upload_type_for_internal_format(0U) == gl_unsigned_byte);
|
||||
}
|
||||
|
||||
void maps_image_channel_count_to_texture_format(pp::tests::Harness& h)
|
||||
{
|
||||
constexpr std::uint32_t gl_red = 0x1903U;
|
||||
constexpr std::uint32_t gl_rgb = 0x1907U;
|
||||
constexpr std::uint32_t gl_rgba = 0x1908U;
|
||||
constexpr std::uint32_t gl_rg = 0x8227U;
|
||||
constexpr std::uint32_t gl_r8 = 0x8229U;
|
||||
constexpr std::uint32_t gl_rg8 = 0x822BU;
|
||||
constexpr std::uint32_t gl_rgb8 = 0x8051U;
|
||||
constexpr std::uint32_t gl_rgba8 = 0x8058U;
|
||||
|
||||
const auto r = pp::renderer::gl::texture_format_for_channel_count(1U);
|
||||
const auto rg = pp::renderer::gl::texture_format_for_channel_count(2U);
|
||||
const auto rgb = pp::renderer::gl::texture_format_for_channel_count(3U);
|
||||
const auto rgba = pp::renderer::gl::texture_format_for_channel_count(4U);
|
||||
const auto invalid = pp::renderer::gl::texture_format_for_channel_count(5U);
|
||||
|
||||
PP_EXPECT(h, r.internal_format == gl_r8);
|
||||
PP_EXPECT(h, r.pixel_format == gl_red);
|
||||
PP_EXPECT(h, rg.internal_format == gl_rg8);
|
||||
PP_EXPECT(h, rg.pixel_format == gl_rg);
|
||||
PP_EXPECT(h, rgb.internal_format == gl_rgb8);
|
||||
PP_EXPECT(h, rgb.pixel_format == gl_rgb);
|
||||
PP_EXPECT(h, rgba.internal_format == gl_rgba8);
|
||||
PP_EXPECT(h, rgba.pixel_format == gl_rgba);
|
||||
PP_EXPECT(h, invalid.channel_count == 0U);
|
||||
PP_EXPECT(h, invalid.internal_format == 0U);
|
||||
PP_EXPECT(h, invalid.pixel_format == 0U);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main()
|
||||
@@ -94,5 +124,6 @@ int main()
|
||||
harness.run("detects_gles_texture_float_extensions", detects_gles_texture_float_extensions);
|
||||
harness.run("ignores_gles_texture_extensions_for_webgl_runtime", ignores_gles_texture_extensions_for_webgl_runtime);
|
||||
harness.run("selects_texture_upload_type_from_internal_format", selects_texture_upload_type_from_internal_format);
|
||||
harness.run("maps_image_channel_count_to_texture_format", maps_image_channel_count_to_texture_format);
|
||||
return harness.finish();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user