mirror of
https://github.com/enduro2d/enduro2d.git
synced 2025-12-14 08:07:17 +07:00
add pvrtc v2
This commit is contained in:
@@ -63,7 +63,10 @@ namespace e2d
|
||||
rgb_pvrtc4,
|
||||
|
||||
rgba_pvrtc2,
|
||||
rgba_pvrtc4
|
||||
rgba_pvrtc4,
|
||||
|
||||
rgba_pvrtc2_v2,
|
||||
rgba_pvrtc4_v2
|
||||
};
|
||||
static const char* pixel_type_to_cstr(pixel_type pt) noexcept;
|
||||
public:
|
||||
|
||||
@@ -12,35 +12,38 @@ namespace
|
||||
|
||||
struct pixel_type_description {
|
||||
const char* cstr;
|
||||
u32 minimal_size;
|
||||
u32 bits_per_pixel;
|
||||
bool color;
|
||||
bool depth;
|
||||
bool stencil;
|
||||
pixel_declaration::pixel_type type;
|
||||
bool compressed;
|
||||
bool must_be_square;
|
||||
bool must_be_power_of_two;
|
||||
};
|
||||
|
||||
const pixel_type_description pixel_type_descriptions[] = {
|
||||
{"depth16", 1, 16, false, true, false, pixel_declaration::pixel_type::depth16, false, false, false},
|
||||
{"depth24", 1, 24, false, true, false, pixel_declaration::pixel_type::depth24, false, false, false},
|
||||
{"depth32", 1, 32, false, true, false, pixel_declaration::pixel_type::depth32, false, false, false},
|
||||
{"depth24_stencil8", 1, 32, false, true, true, pixel_declaration::pixel_type::depth24_stencil8, false, false, false},
|
||||
{"depth16", 16, false, true, false, pixel_declaration::pixel_type::depth16, false},
|
||||
{"depth24", 24, false, true, false, pixel_declaration::pixel_type::depth24, false},
|
||||
{"depth32", 32, false, true, false, pixel_declaration::pixel_type::depth32, false},
|
||||
{"depth24_stencil8", 32, false, true, true, pixel_declaration::pixel_type::depth24_stencil8, false},
|
||||
|
||||
{"rgb8", 1, 24, true, false, false, pixel_declaration::pixel_type::rgb8, false, false, false},
|
||||
{"rgba8", 1, 32, true, false, false, pixel_declaration::pixel_type::rgba8, false, false, false},
|
||||
{"rgb8", 24, true, false, false, pixel_declaration::pixel_type::rgb8, false},
|
||||
{"rgba8", 32, true, false, false, pixel_declaration::pixel_type::rgba8, false},
|
||||
|
||||
{"rgb_dxt1", 4, 4, true, false, false, pixel_declaration::pixel_type::rgb_dxt1, true, false, true},
|
||||
{"rgba_dxt1", 4, 4, true, false, false, pixel_declaration::pixel_type::rgba_dxt1, true, false, true},
|
||||
{"rgba_dxt3", 4, 8, true, false, false, pixel_declaration::pixel_type::rgba_dxt3, true, false, true},
|
||||
{"rgba_dxt5", 4, 8, true, false, false, pixel_declaration::pixel_type::rgba_dxt5, true, false, true},
|
||||
{"rgb_dxt1", 4, true, false, false, pixel_declaration::pixel_type::rgb_dxt1, true},
|
||||
{"rgba_dxt1", 4, true, false, false, pixel_declaration::pixel_type::rgba_dxt1, true},
|
||||
{"rgba_dxt3", 8, true, false, false, pixel_declaration::pixel_type::rgba_dxt3, true},
|
||||
{"rgba_dxt5", 8, true, false, false, pixel_declaration::pixel_type::rgba_dxt5, true},
|
||||
|
||||
{"rgb_pvrtc2", 8, 2, true, false, false, pixel_declaration::pixel_type::rgb_pvrtc2, true, true, true},
|
||||
{"rgb_pvrtc4", 8, 4, true, false, false, pixel_declaration::pixel_type::rgb_pvrtc4, true, true, true},
|
||||
{"rgba_pvrtc2", 8, 2, true, false, false, pixel_declaration::pixel_type::rgba_pvrtc2, true, true, true},
|
||||
{"rgba_pvrtc4", 8, 4, true, false, false, pixel_declaration::pixel_type::rgba_pvrtc4, true, true, true}
|
||||
{"rgb_pvrtc2", 2, true, false, false, pixel_declaration::pixel_type::rgb_pvrtc2, true},
|
||||
{"rgb_pvrtc4", 4, true, false, false, pixel_declaration::pixel_type::rgb_pvrtc4, true},
|
||||
{"rgba_pvrtc2", 2, true, false, false, pixel_declaration::pixel_type::rgba_pvrtc2, true},
|
||||
{"rgba_pvrtc4", 4, true, false, false, pixel_declaration::pixel_type::rgba_pvrtc4, true},
|
||||
|
||||
{"rgba_pvrtc2", 2, true, false, false, pixel_declaration::pixel_type::rgba_pvrtc2, true},
|
||||
{"rgba_pvrtc4", 4, true, false, false, pixel_declaration::pixel_type::rgba_pvrtc4, true},
|
||||
|
||||
{"rgba_pvrtc2_v2", 2, true, false, false, pixel_declaration::pixel_type::rgba_pvrtc2_v2, true},
|
||||
{"rgba_pvrtc4_v2", 4, true, false, false, pixel_declaration::pixel_type::rgba_pvrtc4_v2, true}
|
||||
};
|
||||
|
||||
const pixel_type_description& get_pixel_type_description(pixel_declaration::pixel_type type) noexcept {
|
||||
|
||||
@@ -238,14 +238,34 @@ namespace e2d
|
||||
return *this;
|
||||
}
|
||||
|
||||
render& render::execute(const target_command& command) {
|
||||
E2D_UNUSED(command);
|
||||
return *this;
|
||||
}
|
||||
|
||||
render& render::execute(const viewport_command& command) {
|
||||
E2D_UNUSED(command);
|
||||
return *this;
|
||||
}
|
||||
|
||||
render& render::execute(const render_target_command& command) {
|
||||
E2D_UNUSED(command);
|
||||
return *this;
|
||||
const render::device_caps& render::device_capabilities() const noexcept {
|
||||
static device_caps caps;
|
||||
return caps;
|
||||
}
|
||||
|
||||
bool render::is_pixel_supported(const pixel_declaration& decl) const noexcept {
|
||||
E2D_UNUSED(decl);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool render::is_index_supported(const index_declaration& decl) const noexcept {
|
||||
E2D_UNUSED(decl);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool render::is_vertex_supported(const vertex_declaration& decl) const noexcept {
|
||||
E2D_UNUSED(decl);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1006,6 +1006,9 @@ namespace e2d
|
||||
case pixel_declaration::pixel_type::rgba_pvrtc2:
|
||||
case pixel_declaration::pixel_type::rgba_pvrtc4:
|
||||
return __GLEW_IMG_texture_compression_pvrtc;
|
||||
case pixel_declaration::pixel_type::rgba_pvrtc2_v2:
|
||||
case pixel_declaration::pixel_type::rgba_pvrtc4_v2:
|
||||
return __GLEW_IMG_texture_compression_pvrtc2;
|
||||
default:
|
||||
E2D_ASSERT_MSG(false, "unexpected pixel type");
|
||||
return false;
|
||||
|
||||
@@ -769,6 +769,9 @@ namespace e2d { namespace opengl
|
||||
|
||||
DEFINE_CASE(rgba_pvrtc2, GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG);
|
||||
DEFINE_CASE(rgba_pvrtc4, GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG);
|
||||
|
||||
DEFINE_CASE(rgba_pvrtc2_v2, GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG);
|
||||
DEFINE_CASE(rgba_pvrtc4_v2, GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG);
|
||||
default:
|
||||
E2D_ASSERT_MSG(false, "unexpected pixel type");
|
||||
return GL_RGBA;
|
||||
@@ -798,6 +801,9 @@ namespace e2d { namespace opengl
|
||||
|
||||
DEFINE_CASE(rgba_pvrtc2, rgba_pvrtc2);
|
||||
DEFINE_CASE(rgba_pvrtc4, rgba_pvrtc4);
|
||||
|
||||
DEFINE_CASE(rgba_pvrtc2_v2, rgba_pvrtc2_v2);
|
||||
DEFINE_CASE(rgba_pvrtc4_v2, rgba_pvrtc4_v2);
|
||||
default:
|
||||
E2D_ASSERT_MSG(false, "unexpected image data format");
|
||||
return pixel_declaration(pixel_declaration::pixel_type::rgba8);
|
||||
|
||||
Reference in New Issue
Block a user