Integrated the texture submodule into gl backend
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
#include "codec.h"
|
||||
#include "internal\codecs.h"
|
||||
#include "internal\morton.h"
|
||||
#include "common/color.h"
|
||||
#include "common/math_util.h"
|
||||
#include "common/swap.h"
|
||||
#include "common/vector_math.h"
|
||||
#include "video_core/texture/codec.h"
|
||||
#include "video_core/texture/internal/codecs.h"
|
||||
#include "video_core/texture/internal/morton.h"
|
||||
|
||||
namespace Pica {
|
||||
namespace Texture {
|
||||
@@ -17,18 +21,6 @@ void Codec::encode() {
|
||||
this->encode_morton_pass();
|
||||
};
|
||||
|
||||
void Codec::setSize() {
|
||||
this->start_nibbles_size = format_size;
|
||||
};
|
||||
|
||||
inline void Codec::setWidth(u32 width) {
|
||||
this->width = width;
|
||||
}
|
||||
|
||||
inline void Codec::setHeight(u32 height) {
|
||||
this->height = height;
|
||||
}
|
||||
|
||||
void Codec::configTiling(bool active, u32 tiling) {
|
||||
this->morton = true;
|
||||
this->morton_pass_tiling = tiling;
|
||||
@@ -63,15 +55,16 @@ bool Codec::invalid() {
|
||||
}
|
||||
|
||||
void Codec::init(bool decode) {
|
||||
this->setSize();
|
||||
this->expected_nibbles_size = this->start_nibbles_size;
|
||||
if (decode) {
|
||||
if (this->raw_RGBA)
|
||||
this->expected_nibbles_size = 8;
|
||||
} else {
|
||||
this->start_nibbles_size = this->format_size;
|
||||
if (this->raw_RGBA)
|
||||
this->expected_nibbles_size = this->format_size;
|
||||
if (this->preconverted)
|
||||
this->start_nibbles_size = 8;
|
||||
if (!this->raw_RGBA)
|
||||
this->expected_nibbles_size = this->start_nibbles_size;
|
||||
}
|
||||
if (!this->external_result_buffer) {
|
||||
size_t buff_size = this->width * this->height * this->expected_nibbles_size / 2;
|
||||
@@ -80,7 +73,7 @@ void Codec::init(bool decode) {
|
||||
}
|
||||
}
|
||||
|
||||
inline void Codec::decode_morton_pass() {
|
||||
void Codec::decode_morton_pass() {
|
||||
if (this->morton_pass_tiling == 8)
|
||||
Decoders::Morton_8x8(this->target_buffer, this->passing_buffer, this->width, this->height,
|
||||
this->start_nibbles_size * 4);
|
||||
@@ -89,7 +82,7 @@ inline void Codec::decode_morton_pass() {
|
||||
this->start_nibbles_size * 4);
|
||||
}
|
||||
|
||||
inline void Codec::encode_morton_pass() {
|
||||
void Codec::encode_morton_pass() {
|
||||
if (this->morton_pass_tiling == 8)
|
||||
Encoders::Morton_8x8(this->target_buffer, this->passing_buffer, this->width, this->height,
|
||||
this->start_nibbles_size * 4);
|
||||
@@ -98,41 +91,41 @@ inline void Codec::encode_morton_pass() {
|
||||
this->start_nibbles_size * 4);
|
||||
}
|
||||
|
||||
std::unique_ptr<Codec> CodecFactory::build(Format format, u8* target, u32 width, u32 height) {
|
||||
std::unique_ptr<Codec> CodecFactory::build(Format::Type format, u8* target, u32 width, u32 height) {
|
||||
switch (format) {
|
||||
case Format::RGBA8:
|
||||
case Format::Type::RGBA8:
|
||||
return std::make_unique<RGBACodec>(target, width, height);
|
||||
case Format::RGB8:
|
||||
case Format::Type::RGB8:
|
||||
return std::make_unique<RGBCodec>(target, width, height);
|
||||
case Format::RGB5A1:
|
||||
case Format::Type::RGB5A1:
|
||||
return std::make_unique<RGB5A1Codec>(target, width, height);
|
||||
case Format::RGB565:
|
||||
case Format::Type::RGB565:
|
||||
return std::make_unique<RGB565Codec>(target, width, height);
|
||||
case Format::RGBA4:
|
||||
case Format::Type::RGBA4:
|
||||
return std::make_unique<RGBA4Codec>(target, width, height);
|
||||
case Format::RG8:
|
||||
case Format::Type::RG8:
|
||||
return std::make_unique<RG8Codec>(target, width, height);
|
||||
case Format::IA8:
|
||||
case Format::Type::IA8:
|
||||
return std::make_unique<IA8Codec>(target, width, height);
|
||||
case Format::I8:
|
||||
case Format::Type::I8:
|
||||
return std::make_unique<I8Codec>(target, width, height);
|
||||
case Format::A8:
|
||||
case Format::Type::A8:
|
||||
return std::make_unique<A8Codec>(target, width, height);
|
||||
case Format::IA4:
|
||||
case Format::Type::IA4:
|
||||
return std::make_unique<IA4Codec>(target, width, height);
|
||||
case Format::I4:
|
||||
case Format::Type::I4:
|
||||
return std::make_unique<I4Codec>(target, width, height);
|
||||
case Format::A4:
|
||||
case Format::Type::A4:
|
||||
return std::make_unique<A4Codec>(target, width, height);
|
||||
case Format::ETC1:
|
||||
case Format::Type::ETC1:
|
||||
return std::make_unique<ETC1Codec>(target, width, height);
|
||||
case Format::ETC1A4:
|
||||
case Format::Type::ETC1A4:
|
||||
return std::make_unique<ETC1A4Codec>(target, width, height);
|
||||
case Format::D16:
|
||||
case Format::Type::D16:
|
||||
return std::make_unique<D16Codec>(target, width, height);
|
||||
case Format::D24:
|
||||
case Format::Type::D24:
|
||||
return std::make_unique<D24Codec>(target, width, height);
|
||||
case Format::D24S8:
|
||||
case Format::Type::D24S8:
|
||||
return std::make_unique<D24S8Codec>(target, width, height);
|
||||
default:
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user