diff --git a/include/bgfx.c99.h b/include/bgfx.c99.h index 905de697..92bf737c 100644 --- a/include/bgfx.c99.h +++ b/include/bgfx.c99.h @@ -94,6 +94,7 @@ typedef enum bgfx_texture_format BGFX_TEXTURE_FORMAT_R16F, BGFX_TEXTURE_FORMAT_R32, BGFX_TEXTURE_FORMAT_R32F, + BGFX_TEXTURE_FORMAT_RG8, BGFX_TEXTURE_FORMAT_RG16, BGFX_TEXTURE_FORMAT_RG16F, BGFX_TEXTURE_FORMAT_RG32, diff --git a/include/bgfx.h b/include/bgfx.h index d9929e5e..5ab63fc0 100644 --- a/include/bgfx.h +++ b/include/bgfx.h @@ -126,6 +126,7 @@ namespace bgfx R16F, R32, R32F, + RG8, RG16, RG16F, RG32, diff --git a/src/image.cpp b/src/image.cpp index e1d13155..c795a613 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -33,6 +33,7 @@ namespace bgfx { 16, 1, 1, 2 }, // R16F { 32, 1, 1, 4 }, // R32 { 32, 1, 1, 4 }, // R32F + { 16, 1, 1, 2 }, // RG8 { 32, 1, 1, 4 }, // RG16 { 32, 1, 1, 4 }, // RG16F { 64, 1, 1, 8 }, // RG32 @@ -81,6 +82,7 @@ namespace bgfx "R16F", // R16F "R32", // R32 "R32F", // R32F + "RG8", // RG8 "RG16", // RG16 "RG16F", // RG16F "RG32", // RG32 diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index 1b2dcae0..6bc0e793 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -220,6 +220,7 @@ namespace bgfx { DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_UNKNOWN }, // R16F { DXGI_FORMAT_R32_UINT, DXGI_FORMAT_R32_UINT, DXGI_FORMAT_UNKNOWN }, // R32 { DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_UNKNOWN }, // R32F + { DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_UNKNOWN }, // RG8 { DXGI_FORMAT_R16G16_UNORM, DXGI_FORMAT_R16G16_UNORM, DXGI_FORMAT_UNKNOWN }, // RG16 { DXGI_FORMAT_R16G16_FLOAT, DXGI_FORMAT_R16G16_FLOAT, DXGI_FORMAT_UNKNOWN }, // RG16F { DXGI_FORMAT_R32G32_UINT, DXGI_FORMAT_R32G32_UINT, DXGI_FORMAT_UNKNOWN }, // RG32 diff --git a/src/renderer_d3d9.cpp b/src/renderer_d3d9.cpp index 455e2f19..41bd8107 100644 --- a/src/renderer_d3d9.cpp +++ b/src/renderer_d3d9.cpp @@ -206,6 +206,7 @@ namespace bgfx { D3DFMT_R16F }, // R16F { D3DFMT_UNKNOWN }, // R32 { D3DFMT_R32F }, // R32F + { D3DFMT_A8L8 }, // RG8 { D3DFMT_G16R16 }, // RG16 { D3DFMT_G16R16F }, // RG16F { D3DFMT_UNKNOWN }, // RG32 diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index ac0558d5..31dd3eab 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -199,6 +199,7 @@ namespace bgfx { GL_R16F, GL_RED, GL_HALF_FLOAT, true }, // R16F { GL_R32UI, GL_RED, GL_UNSIGNED_INT, true }, // R32 { GL_R32F, GL_RED, GL_FLOAT, true }, // R32F + { GL_RG8, GL_RG, GL_UNSIGNED_BYTE, true }, // RG8 { GL_RG16, GL_RG, GL_UNSIGNED_SHORT, true }, // RG16 { GL_RG16F, GL_RG, GL_FLOAT, true }, // RG16F { GL_RG32UI, GL_RG, GL_UNSIGNED_INT, true }, // RG32 @@ -247,6 +248,7 @@ namespace bgfx GL_R16F, // R16F GL_R32UI, // R32 GL_R32F, // R32F + GL_RG8, // RG8 GL_RG16, // RG16 GL_RG16F, // RG16F GL_RG32UI, // RG32 @@ -347,6 +349,7 @@ namespace bgfx EXT_texture_compression_s3tc, EXT_texture_filter_anisotropic, EXT_texture_format_BGRA8888, + EXT_texture_rg, EXT_texture_sRGB, EXT_texture_storage, EXT_texture_swizzle, @@ -487,6 +490,7 @@ namespace bgfx { "EXT_texture_compression_s3tc", false, true }, { "EXT_texture_filter_anisotropic", false, true }, { "EXT_texture_format_BGRA8888", false, true }, + { "EXT_texture_rg", false, true }, // GLES2 extension. { "EXT_texture_sRGB", false, true }, { "EXT_texture_storage", false, true }, { "EXT_texture_swizzle", false, true }, diff --git a/src/renderer_gl.h b/src/renderer_gl.h index d0a06dc9..955e6505 100644 --- a/src/renderer_gl.h +++ b/src/renderer_gl.h @@ -115,6 +115,10 @@ typedef uint64_t GLuint64; # define GL_R32F 0x822E #endif // GL_R32F +#ifndef GL_RG8 +# define GL_RG8 0x822B +#endif // GL_RG8 + #ifndef GL_RG16 # define GL_RG16 0x822C #endif // GL_RG16 diff --git a/tools/shaderc/shaderc.cpp b/tools/shaderc/shaderc.cpp index e4d76896..3d29a418 100644 --- a/tools/shaderc/shaderc.cpp +++ b/tools/shaderc/shaderc.cpp @@ -558,7 +558,7 @@ void strreplace(char* _str, const char* _find, const char* _replace) char* replace = (char*)alloca(len+1); bx::strlcpy(replace, _replace, len+1); - for (uint32_t ii = strlen(replace); ii < len; ++ii) + for (size_t ii = strlen(replace); ii < len; ++ii) { replace[ii] = ' '; } @@ -2052,7 +2052,7 @@ int main(int _argc, const char* _argv[]) preprocessor.run(input); delete [] data; - size = preprocessor.m_preprocessed.size(); + size = (uint32_t)preprocessor.m_preprocessed.size(); data = new char[size+padding+1]; memcpy(data, preprocessor.m_preprocessed.c_str(), size); memset(&data[size], 0, padding+1);