Add a PositionTranslate func and add Errors for TextureSize mismatch
This commit is contained in:
@@ -174,6 +174,13 @@ Li::Texture GfxCitro3D::LoadTexture(const std::vector<PD::u8>& pixels, int w,
|
||||
int h, TextureFormat type,
|
||||
TextureFilter filter) {
|
||||
if (!impl || w > 1024 || h > 1024) return Li::Texture();
|
||||
if (pixels.size() !=
|
||||
static_cast<size_t>(w * h * Li::TextureFormat2Bpp(type))) {
|
||||
PDERR("Failed to load Texture due to Size mismatch: {} != {}",
|
||||
pixels.size(),
|
||||
static_cast<size_t>(w * h * Li::TextureFormat2Bpp(type)));
|
||||
return Li::Texture();
|
||||
}
|
||||
// Don't check here as check done before
|
||||
PD::Li::Texture res;
|
||||
int bpp = impl->TextureFormat2Bpp(type);
|
||||
|
||||
@@ -209,6 +209,13 @@ Li::Texture GfxDirectX9::LoadTexture(const std::vector<PD::u8>& pixels, int w,
|
||||
int h, TextureFormat type,
|
||||
TextureFilter filter) {
|
||||
if (!impl || !impl->Device) return Li::Texture();
|
||||
if (pixels.size() !=
|
||||
static_cast<size_t>(w * h * Li::TextureFormat2Bpp(type))) {
|
||||
PDERR("Failed to load Texture due to Size mismatch: {} != {}",
|
||||
pixels.size(),
|
||||
static_cast<size_t>(w * h * Li::TextureFormat2Bpp(type)));
|
||||
return Li::Texture();
|
||||
}
|
||||
IDirect3DTexture9* tex = nullptr;
|
||||
D3DFORMAT fmt = D3DFMT_A8R8G8B8;
|
||||
if (type == TextureFormat::RGB24)
|
||||
|
||||
@@ -129,6 +129,13 @@ void GfxOpenGL2::SysReset() {
|
||||
Li::Texture GfxOpenGL2::LoadTexture(const std::vector<PD::u8>& pixels, int w,
|
||||
int h, TextureFormat type,
|
||||
TextureFilter filter) {
|
||||
if (pixels.size() !=
|
||||
static_cast<size_t>(w * h * Li::TextureFormat2Bpp(type))) {
|
||||
PDERR("Failed to load Texture due to Size mismatch: {} != {}",
|
||||
pixels.size(),
|
||||
static_cast<size_t>(w * h * Li::TextureFormat2Bpp(type)));
|
||||
return Li::Texture();
|
||||
}
|
||||
GLuint texID;
|
||||
glGenTextures(1, &texID);
|
||||
glBindTexture(GL_TEXTURE_2D, texID);
|
||||
|
||||
@@ -99,6 +99,13 @@ void GfxOpenGL3::SysReset() {
|
||||
Li::Texture GfxOpenGL3::LoadTexture(const std::vector<PD::u8>& pixels, int w,
|
||||
int h, TextureFormat type,
|
||||
TextureFilter filter) {
|
||||
if (pixels.size() !=
|
||||
static_cast<size_t>(w * h * Li::TextureFormat2Bpp(type))) {
|
||||
PDERR("Failed to load Texture due to Size mismatch: {} != {}",
|
||||
pixels.size(),
|
||||
static_cast<size_t>(w * h * Li::TextureFormat2Bpp(type)));
|
||||
return Li::Texture();
|
||||
}
|
||||
GLuint texID;
|
||||
glGenTextures(1, &texID);
|
||||
glBindTexture(GL_TEXTURE_2D, texID);
|
||||
|
||||
Reference in New Issue
Block a user