bgfx_utils.cpp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691
  1. /*
  2. * Copyright 2011-2016 Branimir Karadzic. All rights reserved.
  3. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
  4. */
  5. #include <string.h> // strlen
  6. #include "common.h"
  7. #include <tinystl/allocator.h>
  8. #include <tinystl/vector.h>
  9. #include <tinystl/string.h>
  10. namespace stl = tinystl;
  11. #include <bgfx/bgfx.h>
  12. #include <bx/commandline.h>
  13. #include <bx/fpumath.h>
  14. #include <bx/readerwriter.h>
  15. #include <bx/string.h>
  16. #include "entry/entry.h"
  17. #include <ib-compress/indexbufferdecompression.h>
  18. #include "bgfx_utils.h"
  19. void* load(bx::FileReaderI* _reader, bx::AllocatorI* _allocator, const char* _filePath, uint32_t* _size)
  20. {
  21. if (bx::open(_reader, _filePath) )
  22. {
  23. uint32_t size = (uint32_t)bx::getSize(_reader);
  24. void* data = BX_ALLOC(_allocator, size);
  25. bx::read(_reader, data, size);
  26. bx::close(_reader);
  27. if (NULL != _size)
  28. {
  29. *_size = size;
  30. }
  31. return data;
  32. }
  33. else
  34. {
  35. DBG("Failed to open: %s.", _filePath);
  36. }
  37. if (NULL != _size)
  38. {
  39. *_size = 0;
  40. }
  41. return NULL;
  42. }
  43. void* load(const char* _filePath, uint32_t* _size)
  44. {
  45. return load(entry::getFileReader(), entry::getAllocator(), _filePath, _size);
  46. }
  47. void unload(void* _ptr)
  48. {
  49. BX_FREE(entry::getAllocator(), _ptr);
  50. }
  51. static const bgfx::Memory* loadMem(bx::FileReaderI* _reader, const char* _filePath)
  52. {
  53. if (bx::open(_reader, _filePath) )
  54. {
  55. uint32_t size = (uint32_t)bx::getSize(_reader);
  56. const bgfx::Memory* mem = bgfx::alloc(size+1);
  57. bx::read(_reader, mem->data, size);
  58. bx::close(_reader);
  59. mem->data[mem->size-1] = '\0';
  60. return mem;
  61. }
  62. DBG("Failed to load %s.", _filePath);
  63. return NULL;
  64. }
  65. static void* loadMem(bx::FileReaderI* _reader, bx::AllocatorI* _allocator, const char* _filePath, uint32_t* _size)
  66. {
  67. if (bx::open(_reader, _filePath) )
  68. {
  69. uint32_t size = (uint32_t)bx::getSize(_reader);
  70. void* data = BX_ALLOC(_allocator, size);
  71. bx::read(_reader, data, size);
  72. bx::close(_reader);
  73. if (NULL != _size)
  74. {
  75. *_size = size;
  76. }
  77. return data;
  78. }
  79. DBG("Failed to load %s.", _filePath);
  80. return NULL;
  81. }
  82. static bgfx::ShaderHandle loadShader(bx::FileReaderI* _reader, const char* _name)
  83. {
  84. char filePath[512];
  85. const char* shaderPath = "shaders/dx9/";
  86. switch (bgfx::getRendererType() )
  87. {
  88. case bgfx::RendererType::Direct3D11:
  89. case bgfx::RendererType::Direct3D12:
  90. shaderPath = "shaders/dx11/";
  91. break;
  92. case bgfx::RendererType::OpenGL:
  93. shaderPath = "shaders/glsl/";
  94. break;
  95. case bgfx::RendererType::Metal:
  96. shaderPath = "shaders/metal/";
  97. break;
  98. case bgfx::RendererType::OpenGLES:
  99. shaderPath = "shaders/gles/";
  100. break;
  101. default:
  102. break;
  103. }
  104. strcpy(filePath, shaderPath);
  105. strcat(filePath, _name);
  106. strcat(filePath, ".bin");
  107. return bgfx::createShader(loadMem(_reader, filePath) );
  108. }
  109. bgfx::ShaderHandle loadShader(const char* _name)
  110. {
  111. return loadShader(entry::getFileReader(), _name);
  112. }
  113. bgfx::ProgramHandle loadProgram(bx::FileReaderI* _reader, const char* _vsName, const char* _fsName)
  114. {
  115. bgfx::ShaderHandle vsh = loadShader(_reader, _vsName);
  116. bgfx::ShaderHandle fsh = BGFX_INVALID_HANDLE;
  117. if (NULL != _fsName)
  118. {
  119. fsh = loadShader(_reader, _fsName);
  120. }
  121. return bgfx::createProgram(vsh, fsh, true /* destroy shaders when program is destroyed */);
  122. }
  123. bgfx::ProgramHandle loadProgram(const char* _vsName, const char* _fsName)
  124. {
  125. return loadProgram(entry::getFileReader(), _vsName, _fsName);
  126. }
  127. typedef unsigned char stbi_uc;
  128. extern "C" stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
  129. bgfx::TextureHandle loadTexture(bx::FileReaderI* _reader, const char* _name, uint32_t _flags, uint8_t _skip, bgfx::TextureInfo* _info)
  130. {
  131. char filePath[512] = { '\0' };
  132. if (NULL == strchr(_name, '/') )
  133. {
  134. strcpy(filePath, "textures/");
  135. }
  136. strcat(filePath, _name);
  137. if (NULL != bx::stristr(_name, ".dds")
  138. || NULL != bx::stristr(_name, ".pvr")
  139. || NULL != bx::stristr(_name, ".ktx") )
  140. {
  141. const bgfx::Memory* mem = loadMem(_reader, filePath);
  142. if (NULL != mem)
  143. {
  144. return bgfx::createTexture(mem, _flags, _skip, _info);
  145. }
  146. bgfx::TextureHandle handle = BGFX_INVALID_HANDLE;
  147. DBG("Failed to load %s.", filePath);
  148. return handle;
  149. }
  150. bgfx::TextureHandle handle = BGFX_INVALID_HANDLE;
  151. bx::AllocatorI* allocator = entry::getAllocator();
  152. uint32_t size = 0;
  153. void* data = loadMem(_reader, allocator, filePath, &size);
  154. if (NULL != data)
  155. {
  156. int width = 0;
  157. int height = 0;
  158. int comp = 0;
  159. uint8_t* img = NULL;
  160. img = stbi_load_from_memory( (uint8_t*)data, size, &width, &height, &comp, 4);
  161. BX_FREE(allocator, data);
  162. if (NULL != img)
  163. {
  164. handle = bgfx::createTexture2D(uint16_t(width), uint16_t(height), 1
  165. , bgfx::TextureFormat::RGBA8
  166. , _flags
  167. , bgfx::copy(img, width*height*4)
  168. );
  169. free(img);
  170. if (NULL != _info)
  171. {
  172. bgfx::calcTextureSize(*_info
  173. , uint16_t(width)
  174. , uint16_t(height)
  175. , 0
  176. , false
  177. , 1
  178. , bgfx::TextureFormat::RGBA8
  179. );
  180. }
  181. }
  182. }
  183. else
  184. {
  185. DBG("Failed to load %s.", filePath);
  186. }
  187. return handle;
  188. }
  189. bgfx::TextureHandle loadTexture(const char* _name, uint32_t _flags, uint8_t _skip, bgfx::TextureInfo* _info)
  190. {
  191. return loadTexture(entry::getFileReader(), _name, _flags, _skip, _info);
  192. }
  193. void calcTangents(void* _vertices, uint16_t _numVertices, bgfx::VertexDecl _decl, const uint16_t* _indices, uint32_t _numIndices)
  194. {
  195. struct PosTexcoord
  196. {
  197. float m_x;
  198. float m_y;
  199. float m_z;
  200. float m_pad0;
  201. float m_u;
  202. float m_v;
  203. float m_pad1;
  204. float m_pad2;
  205. };
  206. float* tangents = new float[6*_numVertices];
  207. memset(tangents, 0, 6*_numVertices*sizeof(float) );
  208. PosTexcoord v0;
  209. PosTexcoord v1;
  210. PosTexcoord v2;
  211. for (uint32_t ii = 0, num = _numIndices/3; ii < num; ++ii)
  212. {
  213. const uint16_t* indices = &_indices[ii*3];
  214. uint32_t i0 = indices[0];
  215. uint32_t i1 = indices[1];
  216. uint32_t i2 = indices[2];
  217. bgfx::vertexUnpack(&v0.m_x, bgfx::Attrib::Position, _decl, _vertices, i0);
  218. bgfx::vertexUnpack(&v0.m_u, bgfx::Attrib::TexCoord0, _decl, _vertices, i0);
  219. bgfx::vertexUnpack(&v1.m_x, bgfx::Attrib::Position, _decl, _vertices, i1);
  220. bgfx::vertexUnpack(&v1.m_u, bgfx::Attrib::TexCoord0, _decl, _vertices, i1);
  221. bgfx::vertexUnpack(&v2.m_x, bgfx::Attrib::Position, _decl, _vertices, i2);
  222. bgfx::vertexUnpack(&v2.m_u, bgfx::Attrib::TexCoord0, _decl, _vertices, i2);
  223. const float bax = v1.m_x - v0.m_x;
  224. const float bay = v1.m_y - v0.m_y;
  225. const float baz = v1.m_z - v0.m_z;
  226. const float bau = v1.m_u - v0.m_u;
  227. const float bav = v1.m_v - v0.m_v;
  228. const float cax = v2.m_x - v0.m_x;
  229. const float cay = v2.m_y - v0.m_y;
  230. const float caz = v2.m_z - v0.m_z;
  231. const float cau = v2.m_u - v0.m_u;
  232. const float cav = v2.m_v - v0.m_v;
  233. const float det = (bau * cav - bav * cau);
  234. const float invDet = 1.0f / det;
  235. const float tx = (bax * cav - cax * bav) * invDet;
  236. const float ty = (bay * cav - cay * bav) * invDet;
  237. const float tz = (baz * cav - caz * bav) * invDet;
  238. const float bx = (cax * bau - bax * cau) * invDet;
  239. const float by = (cay * bau - bay * cau) * invDet;
  240. const float bz = (caz * bau - baz * cau) * invDet;
  241. for (uint32_t jj = 0; jj < 3; ++jj)
  242. {
  243. float* tanu = &tangents[indices[jj]*6];
  244. float* tanv = &tanu[3];
  245. tanu[0] += tx;
  246. tanu[1] += ty;
  247. tanu[2] += tz;
  248. tanv[0] += bx;
  249. tanv[1] += by;
  250. tanv[2] += bz;
  251. }
  252. }
  253. for (uint32_t ii = 0; ii < _numVertices; ++ii)
  254. {
  255. const float* tanu = &tangents[ii*6];
  256. const float* tanv = &tangents[ii*6 + 3];
  257. float normal[4];
  258. bgfx::vertexUnpack(normal, bgfx::Attrib::Normal, _decl, _vertices, ii);
  259. float ndt = bx::vec3Dot(normal, tanu);
  260. float nxt[3];
  261. bx::vec3Cross(nxt, normal, tanu);
  262. float tmp[3];
  263. tmp[0] = tanu[0] - normal[0] * ndt;
  264. tmp[1] = tanu[1] - normal[1] * ndt;
  265. tmp[2] = tanu[2] - normal[2] * ndt;
  266. float tangent[4];
  267. bx::vec3Norm(tangent, tmp);
  268. tangent[3] = bx::vec3Dot(nxt, tanv) < 0.0f ? -1.0f : 1.0f;
  269. bgfx::vertexPack(tangent, true, bgfx::Attrib::Tangent, _decl, _vertices, ii);
  270. }
  271. delete [] tangents;
  272. }
  273. struct Aabb
  274. {
  275. float m_min[3];
  276. float m_max[3];
  277. };
  278. struct Obb
  279. {
  280. float m_mtx[16];
  281. };
  282. struct Sphere
  283. {
  284. float m_center[3];
  285. float m_radius;
  286. };
  287. struct Primitive
  288. {
  289. uint32_t m_startIndex;
  290. uint32_t m_numIndices;
  291. uint32_t m_startVertex;
  292. uint32_t m_numVertices;
  293. Sphere m_sphere;
  294. Aabb m_aabb;
  295. Obb m_obb;
  296. };
  297. typedef stl::vector<Primitive> PrimitiveArray;
  298. struct Group
  299. {
  300. Group()
  301. {
  302. reset();
  303. }
  304. void reset()
  305. {
  306. m_vbh.idx = bgfx::invalidHandle;
  307. m_ibh.idx = bgfx::invalidHandle;
  308. m_prims.clear();
  309. }
  310. bgfx::VertexBufferHandle m_vbh;
  311. bgfx::IndexBufferHandle m_ibh;
  312. Sphere m_sphere;
  313. Aabb m_aabb;
  314. Obb m_obb;
  315. PrimitiveArray m_prims;
  316. };
  317. namespace bgfx
  318. {
  319. int32_t read(bx::ReaderI* _reader, bgfx::VertexDecl& _decl);
  320. }
  321. struct Mesh
  322. {
  323. void load(bx::ReaderSeekerI* _reader)
  324. {
  325. #define BGFX_CHUNK_MAGIC_VB BX_MAKEFOURCC('V', 'B', ' ', 0x1)
  326. #define BGFX_CHUNK_MAGIC_IB BX_MAKEFOURCC('I', 'B', ' ', 0x0)
  327. #define BGFX_CHUNK_MAGIC_IBC BX_MAKEFOURCC('I', 'B', 'C', 0x0)
  328. #define BGFX_CHUNK_MAGIC_PRI BX_MAKEFOURCC('P', 'R', 'I', 0x0)
  329. using namespace bx;
  330. using namespace bgfx;
  331. Group group;
  332. bx::AllocatorI* allocator = entry::getAllocator();
  333. uint32_t chunk;
  334. while (4 == bx::read(_reader, chunk) )
  335. {
  336. switch (chunk)
  337. {
  338. case BGFX_CHUNK_MAGIC_VB:
  339. {
  340. read(_reader, group.m_sphere);
  341. read(_reader, group.m_aabb);
  342. read(_reader, group.m_obb);
  343. read(_reader, m_decl);
  344. uint16_t stride = m_decl.getStride();
  345. uint16_t numVertices;
  346. read(_reader, numVertices);
  347. const bgfx::Memory* mem = bgfx::alloc(numVertices*stride);
  348. read(_reader, mem->data, mem->size);
  349. group.m_vbh = bgfx::createVertexBuffer(mem, m_decl);
  350. }
  351. break;
  352. case BGFX_CHUNK_MAGIC_IB:
  353. {
  354. uint32_t numIndices;
  355. read(_reader, numIndices);
  356. const bgfx::Memory* mem = bgfx::alloc(numIndices*2);
  357. read(_reader, mem->data, mem->size);
  358. group.m_ibh = bgfx::createIndexBuffer(mem);
  359. }
  360. break;
  361. case BGFX_CHUNK_MAGIC_IBC:
  362. {
  363. uint32_t numIndices;
  364. bx::read(_reader, numIndices);
  365. const bgfx::Memory* mem = bgfx::alloc(numIndices*2);
  366. uint32_t compressedSize;
  367. bx::read(_reader, compressedSize);
  368. void* compressedIndices = BX_ALLOC(allocator, compressedSize);
  369. bx::read(_reader, compressedIndices, compressedSize);
  370. ReadBitstream rbs( (const uint8_t*)compressedIndices, compressedSize);
  371. DecompressIndexBuffer( (uint16_t*)mem->data, numIndices / 3, rbs);
  372. BX_FREE(allocator, compressedIndices);
  373. group.m_ibh = bgfx::createIndexBuffer(mem);
  374. }
  375. break;
  376. case BGFX_CHUNK_MAGIC_PRI:
  377. {
  378. uint16_t len;
  379. read(_reader, len);
  380. stl::string material;
  381. material.resize(len);
  382. read(_reader, const_cast<char*>(material.c_str() ), len);
  383. uint16_t num;
  384. read(_reader, num);
  385. for (uint32_t ii = 0; ii < num; ++ii)
  386. {
  387. read(_reader, len);
  388. stl::string name;
  389. name.resize(len);
  390. read(_reader, const_cast<char*>(name.c_str() ), len);
  391. Primitive prim;
  392. read(_reader, prim.m_startIndex);
  393. read(_reader, prim.m_numIndices);
  394. read(_reader, prim.m_startVertex);
  395. read(_reader, prim.m_numVertices);
  396. read(_reader, prim.m_sphere);
  397. read(_reader, prim.m_aabb);
  398. read(_reader, prim.m_obb);
  399. group.m_prims.push_back(prim);
  400. }
  401. m_groups.push_back(group);
  402. group.reset();
  403. }
  404. break;
  405. default:
  406. DBG("%08x at %d", chunk, bx::skip(_reader, 0) );
  407. break;
  408. }
  409. }
  410. }
  411. void unload()
  412. {
  413. for (GroupArray::const_iterator it = m_groups.begin(), itEnd = m_groups.end(); it != itEnd; ++it)
  414. {
  415. const Group& group = *it;
  416. bgfx::destroyVertexBuffer(group.m_vbh);
  417. if (bgfx::isValid(group.m_ibh) )
  418. {
  419. bgfx::destroyIndexBuffer(group.m_ibh);
  420. }
  421. }
  422. m_groups.clear();
  423. }
  424. void submit(uint8_t _id, bgfx::ProgramHandle _program, const float* _mtx, uint64_t _state) const
  425. {
  426. if (BGFX_STATE_MASK == _state)
  427. {
  428. _state = 0
  429. | BGFX_STATE_RGB_WRITE
  430. | BGFX_STATE_ALPHA_WRITE
  431. | BGFX_STATE_DEPTH_WRITE
  432. | BGFX_STATE_DEPTH_TEST_LESS
  433. | BGFX_STATE_CULL_CCW
  434. | BGFX_STATE_MSAA
  435. ;
  436. }
  437. uint32_t cached = bgfx::setTransform(_mtx);
  438. for (GroupArray::const_iterator it = m_groups.begin(), itEnd = m_groups.end(); it != itEnd; ++it)
  439. {
  440. const Group& group = *it;
  441. bgfx::setTransform(cached);
  442. bgfx::setIndexBuffer(group.m_ibh);
  443. bgfx::setVertexBuffer(group.m_vbh);
  444. bgfx::setState(_state);
  445. bgfx::submit(_id, _program);
  446. }
  447. }
  448. void submit(const MeshState*const* _state, uint8_t _numPasses, const float* _mtx, uint16_t _numMatrices) const
  449. {
  450. uint32_t cached = bgfx::setTransform(_mtx, _numMatrices);
  451. for (uint32_t pass = 0; pass < _numPasses; ++pass)
  452. {
  453. const MeshState& state = *_state[pass];
  454. for (GroupArray::const_iterator it = m_groups.begin(), itEnd = m_groups.end(); it != itEnd; ++it)
  455. {
  456. const Group& group = *it;
  457. bgfx::setTransform(cached, _numMatrices);
  458. for (uint8_t tex = 0; tex < state.m_numTextures; ++tex)
  459. {
  460. const MeshState::Texture& texture = state.m_textures[tex];
  461. bgfx::setTexture(texture.m_stage
  462. , texture.m_sampler
  463. , texture.m_texture
  464. , texture.m_flags
  465. );
  466. }
  467. bgfx::setIndexBuffer(group.m_ibh);
  468. bgfx::setVertexBuffer(group.m_vbh);
  469. bgfx::setState(state.m_state);
  470. bgfx::submit(state.m_viewId, state.m_program);
  471. }
  472. }
  473. }
  474. bgfx::VertexDecl m_decl;
  475. typedef stl::vector<Group> GroupArray;
  476. GroupArray m_groups;
  477. };
  478. Mesh* meshLoad(bx::ReaderSeekerI* _reader)
  479. {
  480. Mesh* mesh = new Mesh;
  481. mesh->load(_reader);
  482. return mesh;
  483. }
  484. Mesh* meshLoad(const char* _filePath)
  485. {
  486. bx::FileReaderI* reader = entry::getFileReader();
  487. if (bx::open(reader, _filePath) )
  488. {
  489. Mesh* mesh = meshLoad(reader);
  490. bx::close(reader);
  491. return mesh;
  492. }
  493. return NULL;
  494. }
  495. void meshUnload(Mesh* _mesh)
  496. {
  497. _mesh->unload();
  498. delete _mesh;
  499. }
  500. MeshState* meshStateCreate()
  501. {
  502. MeshState* state = (MeshState*)BX_ALLOC(entry::getAllocator(), sizeof(MeshState) );
  503. return state;
  504. }
  505. void meshStateDestroy(MeshState* _meshState)
  506. {
  507. BX_FREE(entry::getAllocator(), _meshState);
  508. }
  509. void meshSubmit(const Mesh* _mesh, uint8_t _id, bgfx::ProgramHandle _program, const float* _mtx, uint64_t _state)
  510. {
  511. _mesh->submit(_id, _program, _mtx, _state);
  512. }
  513. void meshSubmit(const Mesh* _mesh, const MeshState*const* _state, uint8_t _numPasses, const float* _mtx, uint16_t _numMatrices)
  514. {
  515. _mesh->submit(_state, _numPasses, _mtx, _numMatrices);
  516. }
  517. Args::Args(int _argc, char** _argv)
  518. : m_type(bgfx::RendererType::Count)
  519. , m_pciId(BGFX_PCI_ID_NONE)
  520. {
  521. bx::CommandLine cmdLine(_argc, (const char**)_argv);
  522. if (cmdLine.hasArg("gl") )
  523. {
  524. m_type = bgfx::RendererType::OpenGL;
  525. }
  526. else if (cmdLine.hasArg("noop")
  527. || cmdLine.hasArg("vk") )
  528. {
  529. m_type = bgfx::RendererType::OpenGL;
  530. }
  531. else if (BX_ENABLED(BX_PLATFORM_WINDOWS) )
  532. {
  533. if (cmdLine.hasArg("d3d9") )
  534. {
  535. m_type = bgfx::RendererType::Direct3D9;
  536. }
  537. else if (cmdLine.hasArg("d3d11") )
  538. {
  539. m_type = bgfx::RendererType::Direct3D11;
  540. }
  541. else if (cmdLine.hasArg("d3d12") )
  542. {
  543. m_type = bgfx::RendererType::Direct3D12;
  544. }
  545. }
  546. else if (BX_ENABLED(BX_PLATFORM_OSX) )
  547. {
  548. if (cmdLine.hasArg("mtl") )
  549. {
  550. m_type = bgfx::RendererType::Metal;
  551. }
  552. }
  553. if (cmdLine.hasArg("amd") )
  554. {
  555. m_pciId = BGFX_PCI_ID_AMD;
  556. }
  557. else if (cmdLine.hasArg("nvidia") )
  558. {
  559. m_pciId = BGFX_PCI_ID_NVIDIA;
  560. }
  561. else if (cmdLine.hasArg("intel") )
  562. {
  563. m_pciId = BGFX_PCI_ID_INTEL;
  564. }
  565. else if (cmdLine.hasArg("sw") )
  566. {
  567. m_pciId = BGFX_PCI_ID_SOFTWARE_RASTERIZER;
  568. }
  569. }