PS2GL
OpenGL*-like API for the PS2
Loading...
Searching...
No Matches
texture.cpp
1/* Copyright (C) 2000,2001,2002 Sony Computer Entertainment America
2
3 This file is subject to the terms and conditions of the GNU Lesser
4 General Public License Version 2.1. See the file "COPYING" in the
5 main directory of this archive for more details. */
6
7#include "ps2gl/texture.h"
8
9#include "GL/ps2gl.h"
10
11#include "ps2gl/debug.h"
12#include "ps2gl/dlgmanager.h"
13#include "ps2gl/dlist.h"
14#include "ps2gl/glcontext.h"
15#include "ps2gl/immgmanager.h"
16#include "ps2gl/metrics.h"
17
18#include "kernel.h"
19
20/********************************************
21 * CTexManager
22 */
23
24CTexManager::CTexManager(CGLContext& context)
25 : GLContext(context)
26 , IsTexEnabled(false)
27 , InsideDListDef(false)
28 , Cursor(0)
29 , LastTexSent(NULL)
30 , CurClut(NULL)
31 , TexMode(GS::TexMode::kModulate)
32{
33 // clear the texture name entries
34 for (int i = 0; i < NumTexNames; i++)
35 TexNames[i] = NULL;
36
37 // create the default texture
38 DefaultTex = new CMMTexture(GS::kContext1);
39 CurTexture = DefaultTex;
40}
41
42CTexManager::~CTexManager()
43{
44 delete DefaultTex;
45 if (CurClut)
46 delete CurClut;
47
48 for (int i = 0; i < NumTexNames; i++) {
49 if (TexNames[i])
50 delete TexNames[i];
51 }
52}
53
55 bool IsEnabled;
56
57public:
58 CSetTexEnabledCmd(bool enabled)
59 : IsEnabled(enabled)
60 {
61 }
62 CDListCmd* Play()
63 {
64 pGLContext->GetTexManager().SetTexEnabled(IsEnabled);
65 return CDListCmd::GetNextCmd(this);
66 }
67};
68
69void CTexManager::SetTexEnabled(bool yesNo)
70{
71 if (!InsideDListDef) {
72 if (IsTexEnabled != yesNo) {
73 GLContext.TexEnabledChanged();
74 GLContext.GetImmGeomManager().GetRendererManager().TexEnabledChanged(yesNo);
75 IsTexEnabled = yesNo;
76 }
77 } else {
78 CDList& dlist = GLContext.GetDListManager().GetOpenDList();
79 dlist += CSetTexEnabledCmd(yesNo);
80 GLContext.TexEnabledChanged();
81 }
82}
83
84class CSetTexModeCmd : public CDListCmd {
85 GS::tTexMode Mode;
86
87public:
88 CSetTexModeCmd(GS::tTexMode mode)
89 : Mode(mode)
90 {
91 }
92 CDListCmd* Play()
93 {
94 pGLContext->GetTexManager().SetTexMode(Mode);
95 return CDListCmd::GetNextCmd(this);
96 }
97};
98
99void CTexManager::SetTexMode(GS::tTexMode mode)
100{
101 if (!InsideDListDef)
102 TexMode = mode;
103 else {
104 CDList& dlist = GLContext.GetDListManager().GetOpenDList();
105 dlist += CSetTexModeCmd(mode);
106 }
107}
108
109void CTexManager::GenTextures(GLsizei numNewTexNames, GLuint* newTexNames)
110{
111 for (int curTexName = 0; curTexName < numNewTexNames; curTexName++) {
112 // find the next free tex name and assign it
113 int i;
114 for (i = 0; i < NumTexNames; i++) {
115 // 0 is a reserved tex name in OGL -- don't alloc it
116 if (Cursor != 0 && TexNames[Cursor] == NULL)
117 break;
118
119 IncCursor();
120 }
121 // did we go through all the names without finding any free ones?
122 if (i == NumTexNames) {
123 mError("No free texture names. Time to write a less braindead tex manager.");
124
125 // In release build, return sensible names on failure
126 while (i < NumTexNames) {
127 newTexNames[i] = 0;
128 ++i;
129 }
130 } else {
131 newTexNames[curTexName] = Cursor;
132 IncCursor();
133 }
134 }
135}
136
137void CTexManager::UseCurTexture(CVifSCDmaPacket& renderPacket)
138{
139 if (IsTexEnabled) {
140 GS::tPSM psm = CurTexture->GetPSM();
141 // do we need to send the clut?
142 if (psm == GS::kPsm8 || psm == GS::kPsm8h) {
143 mErrorIf(CurClut == NULL,
144 "Trying to use an indexed-color texture with no color table given!");
145 CurClut->Load(renderPacket);
146 }
147 // use the texture
148 CurTexture->SetTexMode(TexMode);
149 if (CurTexture->GetPSM() == GS::kPsm8
150 || CurTexture->GetPSM() == GS::kPsm8h)
151 CurTexture->SetClut(*CurClut);
152 CurTexture->Use(renderPacket);
153 }
154}
155
157 unsigned int TexName;
158
159public:
160 CBindTextureCmd(unsigned int name)
161 : TexName(name)
162 {
163 }
164 CDListCmd* Play()
165 {
166 pGLContext->GetTexManager().BindTexture(TexName);
167 return CDListCmd::GetNextCmd(this);
168 }
169};
170
171void CTexManager::BindTexture(GLuint texNameToBind)
172{
173 GLContext.TextureChanged();
174
175 if (!InsideDListDef) {
176 if (texNameToBind == 0) {
177 // default texture
178 CurTexture = DefaultTex;
179 } else {
180 if (TexNames[texNameToBind] == NULL)
181 TexNames[texNameToBind] = new CMMTexture(GS::kContext1);
182 CurTexture = TexNames[texNameToBind];
183 }
184
185 pglAddToMetric(kMetricsBindTexture);
186 } else {
187 CDList& dlist = GLContext.GetDListManager().GetOpenDList();
188 dlist += CBindTextureCmd(texNameToBind);
189 }
190}
191
192void CTexManager::DeleteTextures(GLsizei numToDelete, const GLuint* texNames)
193{
194 for (int i = 0; i < numToDelete; i++) {
195 mErrorIf(TexNames[texNames[i]] == NULL,
196 "Trying to delete a texture that doesn't exist!");
197 GLuint texName = texNames[i];
198 if (CurTexture == TexNames[texName])
199 CurTexture = DefaultTex;
200 delete TexNames[texName];
201 TexNames[texName] = NULL;
202 }
203}
204
206 GLenum PName;
207 int Param;
208
209public:
210 CSetCurTexParamCmd(GLenum pname, int param)
211 : PName(pname)
212 , Param(param)
213 {
214 }
215 CDListCmd* Play()
216 {
217 pGLContext->GetTexManager().SetCurTexParam(PName, Param);
218 return CDListCmd::GetNextCmd(this);
219 }
220};
221
222void CTexManager::SetCurTexParam(GLenum pname, GLint param)
223{
224 if (!InsideDListDef) {
225 CMMTexture& tex = *CurTexture;
226
227 switch (pname) {
228 case GL_TEXTURE_MIN_FILTER:
229 tex.SetMinMode((GS::tMinMode)(param & 0xf));
230 break;
231 case GL_TEXTURE_MAG_FILTER:
232 tex.SetMagMode((GS::tMagMode)(param & 0xf));
233 break;
234 case GL_TEXTURE_MIN_LOD:
235 case GL_TEXTURE_MAX_LOD:
236 case GL_TEXTURE_BASE_LEVEL:
237 case GL_TEXTURE_MAX_LEVEL:
238 case GL_TEXTURE_PRIORITY:
239 case GL_TEXTURE_BORDER_COLOR:
240 mNotImplemented();
241 break;
242 case GL_TEXTURE_WRAP_S:
243 tex.SetWrapModeS((GS::tTexWrapMode)(param & 0xf));
244 break;
245 case GL_TEXTURE_WRAP_T:
246 tex.SetWrapModeT((GS::tTexWrapMode)(param & 0xf));
247 break;
248 case GL_TEXTURE_WRAP_R:
249 mNotImplemented("Sorry, only 2d textures.");
250 break;
251 }
252 } else {
253 CDList& dlist = GLContext.GetDListManager().GetOpenDList();
254 dlist += CSetCurTexParamCmd(pname, param);
255 }
256}
257
259 tU128* Image;
260 unsigned int Width, Height;
261 GS::tPSM Psm;
262
263public:
264 CSetCurTexImageCmd(tU128* image, unsigned int w, unsigned int h,
265 GS::tPSM psm)
266 : Image(image)
267 , Width(w)
268 , Height(h)
269 , Psm(psm)
270 {
271 }
272 CDListCmd* Play()
273 {
274 pGLContext->GetTexManager().SetCurTexImage(Image, Width, Height, Psm);
275 return CDListCmd::GetNextCmd(this);
276 }
277};
278
279void CTexManager::SetCurTexImage(tU128* imagePtr, tU32 w, tU32 h,
280 GS::tPSM psm)
281{
282 GLContext.TextureChanged();
283
284 if (!InsideDListDef) {
285 CurTexture->SetImage(imagePtr, w, h, psm);
286 if (psm != GS::kPsm24)
287 CurTexture->SetUseTexAlpha(true);
288 else
289 CurTexture->SetUseTexAlpha(false);
290
291 CurTexture->Free();
292 } else {
293 CDList& dlist = GLContext.GetDListManager().GetOpenDList();
294 dlist += CSetCurTexImageCmd(imagePtr, w, h, psm);
295 }
296}
297
298class CSetCurClutCmd : public CDListCmd {
299 const void* Clut;
300 int NumEntries;
301
302public:
303 CSetCurClutCmd(const void* clut, int numEntries)
304 : Clut(clut)
305 , NumEntries(numEntries)
306 {
307 }
308 CDListCmd* Play()
309 {
310 pGLContext->GetTexManager().SetCurClut(Clut, NumEntries);
311 return CDListCmd::GetNextCmd(this);
312 }
313};
314
315void CTexManager::SetCurClut(const void* clut, int numEntries)
316{
317 GLContext.TextureChanged();
318
319 if (!InsideDListDef) {
320 CMMClut* temp = CurClut;
321 CurClut = new CMMClut(clut);
322 if (temp)
323 delete temp;
324 } else {
325 CDList& dlist = GLContext.GetDListManager().GetOpenDList();
326 dlist += CSetCurClutCmd(clut, numEntries);
327 }
328}
329
331 GS::CMemArea& Texture;
332
333public:
334 CSetGsTextureCmd(GS::CMemArea& tex)
335 : Texture(tex)
336 {
337 }
338 CDListCmd* Play()
339 {
340 pGLContext->GetTexManager().SetGsTexture(Texture);
341 return CDListCmd::GetNextCmd(this);
342 }
343};
344
345void CTexManager::SetGsTexture(GS::CMemArea& area)
346{
347 GLContext.TextureChanged();
348
349 if (!InsideDListDef)
350 CurTexture->SetImage(area);
351 else {
352 CDList& dlist = GLContext.GetDListManager().GetOpenDList();
353 dlist += CSetGsTextureCmd(area);
354 }
355}
356
357/********************************************
358 * CMMTexture methods
359 */
360
361CMMTexture::CMMTexture(GS::tContext context)
362 : CTexture(context)
363 , pImageMem(NULL)
364 , XferImage(false)
365 , IsResident(false)
366{
367 // always load the clut
368 // FIXME: this is obviously not the best way to do
369 // things...fix this once there is reasonable clut
370 // allocation
371 SetClutLoadConditions(1);
372}
373
374CMMTexture::~CMMTexture()
375{
376 delete pImageMem;
377}
378
382void CMMTexture::SetImage(tU128* imagePtr, tU32 w, tU32 h, GS::tPSM psm)
383{
384 if (pImageMem) {
385 // we are being re-initialized
386 delete pImageMem;
387 CTexture::Reset();
388 }
389
390 CTexture::SetImage(imagePtr, w, h, psm, NULL);
391
392 // create a memarea for the image
393 tU32 bufWidth = gsrTex0.tb_width * 64;
394 pImageMem = new GS::CMemArea(bufWidth, h, psm, GS::kAlignBlock);
395
396 XferImage = true;
397}
398
403void CMMTexture::SetImage(const GS::CMemArea& area)
404{
405 CTexEnv::SetPSM(area.GetPixFormat());
406 CTexEnv::SetDimensions(area.GetWidth(), area.GetHeight());
407 SetImageGsAddr(area.GetWordAddr());
408
409 XferImage = false;
410}
411
412void CMMTexture::ChangePsm(GS::tPSM psm)
413{
414 // we only want changes like 8 -> 8h, or 4hh -> 4, not 8 -> 32
415
416 using namespace GS;
417
418 // printf("changing (%d,%d) into ", GetPSM(), psm);
419
420 if (GS::GetBitsPerPixel(psm) == GS::GetBitsPerPixel(GetPSM())) {
421 // printf("%d\n", psm);
422 CTexEnv::SetPSM(psm);
423 pImageUploadPkt->ChangePsm(psm);
424 } else {
425 // on the other hand, don't put an 8h into a 32
426
427 int bpp = GS::GetBitsPerPixel(GetPSM());
428 if (bpp == 8 && GetPSM() == GS::kPsm8h) {
429 // printf("%d\n", kPsm8 );
430 ChangePsm(GS::kPsm8);
431 } else if (bpp == 4 && GetPSM() != GS::kPsm4) {
432 // printf("%d\n", kPsm4 );
433 ChangePsm(GS::kPsm4);
434 } else {
435 // printf("<no change>\n");
436 }
437 }
438}
439
440void CMMTexture::Load(bool waitForEnd)
441{
442 mErrorIf(pImageMem == NULL,
443 "Trying to load a texture that hasn't been defined!");
444 // first set the gs address and flush the cache
445 if (!pImageMem->IsAllocated()) {
446 pImageMem->Alloc();
447 if (GetPSM() != pImageMem->GetPixFormat())
448 ChangePsm(pImageMem->GetPixFormat());
449 SetImageGsAddr(pImageMem->GetWordAddr());
450 IsResident = false;
451 }
452 if (!IsResident) {
453 FlushCache(0);
454 // send the image
455 SendImage(waitForEnd, Packet::kDontFlushCache);
456 IsResident = true;
457
458 pglAddToMetric(kMetricsTextureUploadCount);
459 }
460}
461
462// these two should be templates or something..
463
464void CMMTexture::Load(CSCDmaPacket& packet)
465{
466 mErrorIf(pImageMem == NULL,
467 "Trying to load a texture that hasn't been defined!");
468 if (!pImageMem->IsAllocated()) {
469 pImageMem->Alloc();
470 if (GetPSM() != pImageMem->GetPixFormat())
471 ChangePsm(pImageMem->GetPixFormat());
472 SetImageGsAddr(pImageMem->GetWordAddr());
473 IsResident = false;
474 }
475 if (!IsResident) {
476 SendImage(packet);
477 IsResident = true;
478
479 pglAddToMetric(kMetricsTextureUploadCount);
480 }
481}
482void CMMTexture::Load(CVifSCDmaPacket& packet)
483{
484 mErrorIf(pImageMem == NULL,
485 "Trying to load a texture that hasn't been defined!");
486 if (!pImageMem->IsAllocated()) {
487 pImageMem->Alloc();
488 if (GetPSM() != pImageMem->GetPixFormat())
489 ChangePsm(pImageMem->GetPixFormat());
490 SetImageGsAddr(pImageMem->GetWordAddr());
491 IsResident = false;
492 }
493 if (!IsResident) {
494 // printf("allocing memarea of psm %d (%dx%d)...", pImageMem->GetPixFormat(),
495 // GetW(), GetH() );
496 // printf("at addr %d\n", pImageMem->GetWordAddr() /2048);
497 SendImage(packet);
498 IsResident = true;
499
500 pglAddToMetric(kMetricsTextureUploadCount);
501 }
502}
503
504// again, should be templates..
505
506void CMMTexture::Use(bool waitForEnd)
507{
508 if (XferImage)
509 Load();
510 SendSettings(waitForEnd, Packet::kDontFlushCache);
511}
512void CMMTexture::Use(CSCDmaPacket& packet)
513{
514 if (XferImage)
515 Load(packet);
516 SendSettings(packet);
517}
518void CMMTexture::Use(CVifSCDmaPacket& packet)
519{
520 if (XferImage)
521 Load(packet);
522 SendSettings(packet);
523}
524
525void CMMTexture::Free(void)
526{
527 pImageMem->Free();
528 IsResident = false;
529}
530
531void CMMTexture::BindToSlot(GS::CMemSlot& slot)
532{
533 // slot.Bind(*pImageMem, 0);
534 // if ( GetPSM() != pImageMem->GetPixFormat() )
535 // ChangePsm(pImageMem->GetPixFormat());
536 // SetImageGsAddr( pImageMem->GetWordAddr() );
537 // IsResident = false;
538}
539
540/********************************************
541 * CMMClut
542 */
543
544void CMMClut::Load(CVifSCDmaPacket& packet)
545{
546 if (!GsMem.IsAllocated()) {
547 GsMem.Alloc();
548 SetGsAddr(GsMem.GetWordAddr());
549 Send(packet);
550
551 pglAddToMetric(kMetricsClutUploadCount);
552 }
553}
554
555/********************************************
556 * gl api
557 */
558
559void glGenTextures(GLsizei numNewTexNames, GLuint* newTexNames)
560{
561 GL_FUNC_DEBUG("%s\n", __FUNCTION__);
562
563 CTexManager& texManager = pGLContext->GetTexManager();
564 texManager.GenTextures(numNewTexNames, newTexNames);
565}
566
567void glBindTexture(GLenum target, GLuint texName)
568{
569 GL_FUNC_DEBUG("%s\n", __FUNCTION__);
570
571 mErrorIf(target != GL_TEXTURE_2D, "There are only 2D textures in ps2gl");
572
573 CTexManager& texManager = pGLContext->GetTexManager();
574 texManager.BindTexture(texName);
575}
576
577void glDeleteTextures(GLsizei numToDelete, const GLuint* texNames)
578{
579 GL_FUNC_DEBUG("%s\n", __FUNCTION__);
580
581 CTexManager& texManager = pGLContext->GetTexManager();
582 texManager.DeleteTextures(numToDelete, texNames);
583}
584
585void glTexImage2D(GLenum target,
586 GLint level,
587 GLint internalFormat,
588 GLsizei width,
589 GLsizei height,
590 GLint border,
591 GLenum format,
592 GLenum type,
593 const GLvoid* pixels)
594{
595 GL_FUNC_DEBUG("%s\n", __FUNCTION__);
596
597 if (target == GL_PROXY_TEXTURE_2D) {
598 mNotImplemented();
599 return;
600 }
601 if (level > 0) {
602 mNotImplemented("mipmapping");
603 return;
604 }
605 if (border > 0) {
606 mNotImplemented("texture borders");
607 return;
608 }
609 if ((unsigned int)pixels & 0xf) {
610 mNotImplemented("texture data needs to be aligned to at least 16 bytes, "
611 "preferably 9 quads");
612 }
613
614 GS::tPSM psm = GS::kInvalidPsm;
615 switch (format) {
616 case GL_RGBA:
617 if (type == GL_UNSIGNED_BYTE || type == GL_UNSIGNED_INT_8_8_8_8)
618 psm = GS::kPsm32;
619 else if (type == GL_UNSIGNED_SHORT_5_5_5_1)
620 psm = GS::kPsm16;
621 else {
622 mNotImplemented("RGBA textures should have a type of GL_UNSIGNED_BYTE, "
623 "GL_UNSIGNED_INT_8_8_8_8, or GL_UNSIGNED_SHORT_5_5_5_1");
624 }
625 break;
626 case GL_RGB:
627 if (type == GL_UNSIGNED_BYTE)
628 psm = GS::kPsm24;
629 else {
630 mNotImplemented("RGB textures should have a type of GL_UNSIGNED_BYTE");
631 }
632 break;
633 case GL_COLOR_INDEX:
634 if (type == GL_UNSIGNED_BYTE)
635 psm = GS::kPsm8;
636 else {
637 mNotImplemented("indexed textures should have a type of GL_UNSIGNED_BYTE");
638 }
639 break;
640 default:
641 mError("Unknown texture format");
642 }
643
644 if (psm != GS::kInvalidPsm) {
645 CTexManager& tm = pGLContext->GetTexManager();
646 tm.SetCurTexImage((tU128*)pixels, width, height, psm);
647 }
648}
649
650void glColorTable(GLenum target, GLenum internalFormat,
651 GLsizei width, GLenum format, GLenum type,
652 const GLvoid* table)
653{
654 GL_FUNC_DEBUG("%s\n", __FUNCTION__);
655
656 mWarnIf(target != GL_COLOR_TABLE,
657 "glColorTable only supports GL_COLOR_TABLE");
658 // ignore internalFormat
659 mErrorIf(width != 16 && width != 256,
660 "A color table must contain either 16 or 256 entries");
661 mErrorIf(format != GL_RGB && format != GL_RGBA,
662 "The pixel format of color tables must be either GL_RGB or GL_RGBA");
663 mWarnIf(type != GL_UNSIGNED_INT && type != GL_UNSIGNED_INT_8_8_8_8,
664 "The type of color table data must be either GL_UNSIGNED_INT or"
665 "GL_UNSIGNED_INT_8_8_8_8");
666 mErrorIf((unsigned int)table & (16 - 1),
667 "Color tables in ps2gl need to be 16-byte aligned in memory..");
668
669 CTexManager& tm = pGLContext->GetTexManager();
670 tm.SetCurClut(table, width);
671}
672
673void glTexParameteri(GLenum target, GLenum pname, GLint param)
674{
675 GL_FUNC_DEBUG("%s\n", __FUNCTION__);
676
677 if (target != GL_TEXTURE_2D) {
678 mNotImplemented("Sorry, only 2d textures.");
679 return;
680 }
681
682 pGLContext->GetTexManager().SetCurTexParam(pname, param);
683}
684
685void glTexParameterf(GLenum target, GLenum pname, GLfloat param)
686{
687 GL_FUNC_DEBUG("%s\n", __FUNCTION__);
688
689 glTexParameteri(target, pname, (GLint)param);
690}
691
692void glTexParameteriv(GLenum target, GLenum pname, GLint* param)
693{
694 GL_FUNC_DEBUG("%s\n", __FUNCTION__);
695
696 glTexParameteri(target, pname, *param);
697}
698
699void glTexParameterfv(GLenum target, GLenum pname, const GLfloat* param)
700{
701 GL_FUNC_DEBUG("%s\n", __FUNCTION__);
702
703 glTexParameteri(target, pname, (GLint)*param);
704}
705
706void glTexEnvi(GLenum target, GLenum pname, GLint param)
707{
708 GL_FUNC_DEBUG("%s\n", __FUNCTION__);
709
710 CTexManager& tm = pGLContext->GetTexManager();
711
712 switch (param) {
713 case GL_MODULATE:
714 tm.SetTexMode((GS::tTexMode)(param & 0xf));
715 break;
716 case GL_DECAL:
717 mWarn("GL_DECAL functions exactly as GL_REPLACE right now.");
718 case GL_REPLACE:
719 tm.SetTexMode((GS::tTexMode)(param & 0xf));
720 break;
721 case GL_BLEND:
722 mNotImplemented();
723 break;
724 }
725}
726
727void glTexEnvf(GLenum target, GLenum pname, GLfloat param)
728{
729 GL_FUNC_DEBUG("%s\n", __FUNCTION__);
730
731 glTexEnvi(target, pname, (GLint)param);
732}
733
734void glTexEnvfv(GLenum target, GLenum pname, GLfloat* param)
735{
736 GL_FUNC_DEBUG("%s\n", __FUNCTION__);
737
738 glTexEnvi(target, pname, (GLint)*param);
739}
740
741void glTexEnviv(GLenum target, GLenum pname, GLint* param)
742{
743 GL_FUNC_DEBUG("%s\n", __FUNCTION__);
744
745 glTexEnvi(target, pname, *param);
746}
747
748void glTexSubImage2D(GLenum target, int level,
749 int xoffset, int yoffset, int width, int height,
750 GLenum format, GLenum type,
751 const void* pixels)
752{
753 GL_FUNC_DEBUG("%s\n", __FUNCTION__);
754
755 mNotImplemented();
756}
757
758void glCopyTexImage2D(GLenum target, int level,
759 GLenum iformat,
760 int x, int y, int width, int height,
761 int border)
762{
763 GL_FUNC_DEBUG("%s\n", __FUNCTION__);
764
765 mNotImplemented();
766}
767
768void glCopyTexSubImage2D(GLenum target, int level,
769 int xoffset, int yoffset, int x, int y,
770 int width, int height)
771{
772 GL_FUNC_DEBUG("%s\n", __FUNCTION__);
773
774 mNotImplemented();
775}
776
777/********************************************
778 * ps2gl C interface
779 */
780
790void pglFreeTexture(GLuint texId)
791{
792 CTexManager& texManager = pGLContext->GetTexManager();
793 CMMTexture& texture = texManager.GetNamedTexture(texId);
794 texture.Free();
795}
796
802void pglBindTextureToSlot(GLuint texId, pgl_slot_handle_t mem_slot)
803{
804 CTexManager& texManager = pGLContext->GetTexManager();
805 CMMTexture& texture = texManager.GetNamedTexture(texId);
806 texture.BindToSlot(*reinterpret_cast<GS::CMemSlot*>(mem_slot));
807}
808
814void pglTextureFromGsMemArea(pgl_area_handle_t tex_area_handle)
815{
816 CTexManager& texManager = pGLContext->GetTexManager();
817 GS::CMemArea* texArea = reinterpret_cast<GS::CMemArea*>(tex_area_handle);
818 texManager.SetGsTexture(*texArea);
819}
820
void SetImage(const GS::CMemArea &area)
Definition texture.cpp:403
void pglTextureFromGsMemArea(pgl_area_handle_t tex_area_handle)
Definition texture.cpp:814
void pglFreeTexture(GLuint texId)
Definition texture.cpp:790
void pglBindTextureToSlot(GLuint texId, pgl_slot_handle_t mem_slot)
Definition texture.cpp:802