MCPcopy Create free account
hub / github.com/defold/defold / GetAstcTextureFormat

Function GetAstcTextureFormat

engine/graphics/src/graphics.cpp:1072–1099  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1070 }
1071
1072 bool GetAstcTextureFormat(const void* mem, uint32_t memsize, dmGraphics::TextureFormat* out)
1073 {
1074 uint32_t width, height, depth;
1075 if (!dmImage::GetAstcBlockSize(mem, memsize, &width, &height, &depth))
1076 return false;
1077
1078#define CASE_ASTC(_WIDTH, _HEIGHT) if (width == (_WIDTH) && height == (_HEIGHT)) { *out = dmGraphics::TEXTURE_FORMAT_RGBA_ASTC_ ## _WIDTH ## X ## _HEIGHT ; return true; }
1079
1080 CASE_ASTC(4, 4);
1081 CASE_ASTC(5, 4);
1082 CASE_ASTC(5, 5);
1083 CASE_ASTC(6, 5);
1084 CASE_ASTC(6, 6);
1085 CASE_ASTC(8, 5);
1086 CASE_ASTC(8, 6);
1087 CASE_ASTC(8, 8);
1088 CASE_ASTC(10, 5);
1089 CASE_ASTC(10, 6);
1090 CASE_ASTC(10, 8);
1091 CASE_ASTC(10, 10);
1092 CASE_ASTC(12, 10);
1093 CASE_ASTC(12, 12);
1094
1095#undef CASE_ASTC
1096
1097 dmLogError("Astc block size currently unsupported: %u x %u", width, height);
1098 return false;
1099 }
1100
1101 void SetPipelineStateValue(dmGraphics::PipelineState& pipeline_state, State state, uint8_t value)
1102 {

Callers 2

Calls 1

GetAstcBlockSizeFunction · 0.50

Tested by

no test coverage detected