moved some stuff around to avoid code duplication and finish up gl 2D texture code
This commit is contained in:
@@ -58,30 +58,6 @@ static inline uint32_t GetWinVer()
|
||||
return (ovi.dwMajorVersion << 8) | (ovi.dwMinorVersion);
|
||||
}
|
||||
|
||||
static inline uint32_t GetFormatBPP(gs_color_format format)
|
||||
{
|
||||
switch (format) {
|
||||
case GS_A8: return 1;
|
||||
case GS_R8: return 1;
|
||||
case GS_RGBA: return 4;
|
||||
case GS_BGRX: return 4;
|
||||
case GS_BGRA: return 4;
|
||||
case GS_R10G10B10A2: return 4;
|
||||
case GS_RGBA16: return 8;
|
||||
case GS_R16: return 2;
|
||||
case GS_RGBA16F: return 8;
|
||||
case GS_RGBA32F: return 16;
|
||||
case GS_RG16F: return 4;
|
||||
case GS_RG32F: return 8;
|
||||
case GS_R16F: return 2;
|
||||
case GS_R32F: return 4;
|
||||
case GS_DXT1: return 0;
|
||||
case GS_DXT3: return 0;
|
||||
case GS_DXT5: return 0;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static inline DXGI_FORMAT ConvertGSTextureFormat(gs_color_format format)
|
||||
{
|
||||
switch (format) {
|
||||
|
@@ -37,16 +37,18 @@ static inline uint32_t numActualLevels(uint32_t levels, uint32_t width,
|
||||
|
||||
void gs_texture_2d::InitSRD(vector<D3D11_SUBRESOURCE_DATA> &srd, void **data)
|
||||
{
|
||||
uint32_t rowSizeBytes = width * GetFormatBPP(format);
|
||||
uint32_t texSizeBytes = height * rowSizeBytes;
|
||||
uint32_t rowSizeBytes = width * get_format_bpp(format);
|
||||
uint32_t texSizeBytes = height * rowSizeBytes / 8;
|
||||
size_t textures = type == GS_TEXTURE_2D ? 1 : 6;
|
||||
uint32_t actual_levels = numActualLevels(levels, width, height);
|
||||
|
||||
rowSizeBytes /= 8;
|
||||
|
||||
for (size_t i = 0; i < textures; i++) {
|
||||
uint32_t newRowSize = rowSizeBytes;
|
||||
uint32_t newTexSize = texSizeBytes;
|
||||
|
||||
for (size_t j = 0; j < actual_levels; j++) {
|
||||
for (uint32_t j = 0; j < actual_levels; j++) {
|
||||
D3D11_SUBRESOURCE_DATA newSRD;
|
||||
newSRD.pSysMem = *data;
|
||||
newSRD.SysMemPitch = newRowSize;
|
||||
|
Reference in New Issue
Block a user