summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2018-01-03 16:43:46 -0300
committerGitHub <noreply@github.com>2018-01-03 16:43:46 -0300
commit16a49cca04338a58a2f729e58ce81a875bd76067 (patch)
tree1c90853f6b4fd13386a4e90d2ebeb4fe1ff9d3c8
parentb7b0ffd5c49e950c57eeac1171d0900bbbb69fa6 (diff)
parent474523d409d475e5b09f95d4cc5ed8b3b5b53a53 (diff)
Merge pull request #15304 from godotengine/revert-15051-bug-fixes
Revert "Add missing image format RGB10A2. Fixes #14964"
-rw-r--r--core/image.cpp24
-rw-r--r--core/image.h1
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp9
3 files changed, 1 insertions, 33 deletions
diff --git a/core/image.cpp b/core/image.cpp
index 2f2d7efd7c..11429b8782 100644
--- a/core/image.cpp
+++ b/core/image.cpp
@@ -47,7 +47,6 @@ const char *Image::format_names[Image::FORMAT_MAX] = {
"RGBA8",
"RGBA4444",
"RGBA5551",
- "RGB10A2",
"RFloat", //float
"RGFloat",
"RGBFloat",
@@ -113,7 +112,6 @@ int Image::get_format_pixel_size(Format p_format) {
case FORMAT_RGBA8: return 4;
case FORMAT_RGBA4444: return 2;
case FORMAT_RGBA5551: return 2;
- case FORMAT_RGB10A2: return 4;
case FORMAT_RF:
return 4; //float
case FORMAT_RGF: return 8;
@@ -1980,15 +1978,6 @@ Color Image::get_pixel(int p_x, int p_y) const {
float a = ((u >> 15) & 0x1) / 1.0;
return Color(r, g, b, a);
} break;
- case FORMAT_RGB10A2: {
-
- uint32_t u = ((uint32_t *)ptr)[ofs];
- float r = (u & 0x3FF) / 1023.0;
- float g = ((u >> 10) & 0x3FF) / 1023.0;
- float b = ((u >> 20) & 0x3FF) / 1023.0;
- float a = ((u >> 30) & 0x3) / 3.0;
- return Color(r, g, b, a);
- } break;
case FORMAT_RF: {
float r = ((float *)ptr)[ofs];
@@ -2134,18 +2123,6 @@ void Image::set_pixel(int p_x, int p_y, const Color &p_color) {
((uint16_t *)ptr)[ofs] = rgba;
} break;
- case FORMAT_RGB10A2: {
-
- uint32_t rgba = 0;
-
- rgba = uint32_t(CLAMP(p_color.r * 1023.0, 0, 1023));
- rgba |= uint32_t(CLAMP(p_color.g * 1023.0, 0, 1023)) << 10;
- rgba |= uint32_t(CLAMP(p_color.b * 1023.0, 0, 1023)) << 20;
- rgba |= uint32_t(CLAMP(p_color.a * 3.0, 0, 3)) << 30;
-
- ((uint32_t *)ptr)[ofs] = rgba;
-
- } break;
case FORMAT_RF: {
((float *)ptr)[ofs] = p_color.r;
@@ -2323,7 +2300,6 @@ void Image::_bind_methods() {
BIND_ENUM_CONSTANT(FORMAT_RGBA8);
BIND_ENUM_CONSTANT(FORMAT_RGBA4444);
BIND_ENUM_CONSTANT(FORMAT_RGBA5551);
- BIND_ENUM_CONSTANT(FORMAT_RGB10A2);
BIND_ENUM_CONSTANT(FORMAT_RF); //float
BIND_ENUM_CONSTANT(FORMAT_RGF);
BIND_ENUM_CONSTANT(FORMAT_RGBF);
diff --git a/core/image.h b/core/image.h
index efb62a6a29..767f3c6ac5 100644
--- a/core/image.h
+++ b/core/image.h
@@ -68,7 +68,6 @@ public:
FORMAT_RGBA8,
FORMAT_RGBA4444,
FORMAT_RGBA5551,
- FORMAT_RGB10A2,
FORMAT_RF, //float
FORMAT_RGF,
FORMAT_RGBF,
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index 365840b2d8..5ce544ecfb 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -193,13 +193,6 @@ Ref<Image> RasterizerStorageGLES3::_get_gl_image_and_format(const Ref<Image> &p_
r_gl_type = GL_UNSIGNED_SHORT_5_5_5_1;
} break;
- case Image::FORMAT_RGB10A2: {
-
- r_gl_internal_format = GL_RGB10_A2;
- r_gl_format = GL_RGBA;
- r_gl_type = GL_UNSIGNED_INT_2_10_10_10_REV;
-
- } break;
case Image::FORMAT_RF: {
r_gl_internal_format = GL_R32F;
@@ -6097,7 +6090,7 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt) {
color_internal_format = GL_RGB10_A2;
color_format = GL_RGBA;
color_type = GL_UNSIGNED_INT_2_10_10_10_REV;
- image_format = Image::FORMAT_RGB10A2;
+ image_format = Image::FORMAT_RGBA8;
} else {
color_internal_format = GL_RGBA8;