1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
|
/*
* Mesa 3-D graphics library
*
* Copyright (C) 2011 VMware, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file texstorage.c
* GL_ARB_texture_storage functions
*/
#include "glheader.h"
#include "context.h"
#include "enums.h"
#include "imports.h"
#include "macros.h"
#include "teximage.h"
#include "texobj.h"
#include "mipmap.h"
#include "texstorage.h"
#include "textureview.h"
#include "mtypes.h"
#include "glformats.h"
#include "hash.h"
/**
* Check if the given texture target is a legal texture object target
* for a glTexStorage() command.
* This is a bit different than legal_teximage_target() when it comes
* to cube maps.
*/
static bool
legal_texobj_target(const struct gl_context *ctx, GLuint dims, GLenum target)
{
if (dims < 1 || dims > 3) {
_mesa_problem(ctx, "invalid dims=%u in legal_texobj_target()", dims);
return false;
}
switch (dims) {
case 2:
switch (target) {
case GL_TEXTURE_2D:
return true;
case GL_TEXTURE_CUBE_MAP:
return ctx->Extensions.ARB_texture_cube_map;
}
break;
case 3:
switch (target) {
case GL_TEXTURE_3D:
return true;
case GL_TEXTURE_2D_ARRAY:
return ctx->Extensions.EXT_texture_array;
case GL_TEXTURE_CUBE_MAP_ARRAY:
return _mesa_has_texture_cube_map_array(ctx);
}
break;
}
if (!_mesa_is_desktop_gl(ctx))
return false;
switch (dims) {
case 1:
switch (target) {
case GL_TEXTURE_1D:
case GL_PROXY_TEXTURE_1D:
return true;
default:
return false;
}
case 2:
switch (target) {
case GL_PROXY_TEXTURE_2D:
return true;
case GL_PROXY_TEXTURE_CUBE_MAP:
return ctx->Extensions.ARB_texture_cube_map;
case GL_TEXTURE_RECTANGLE:
case GL_PROXY_TEXTURE_RECTANGLE:
return ctx->Extensions.NV_texture_rectangle;
case GL_TEXTURE_1D_ARRAY:
case GL_PROXY_TEXTURE_1D_ARRAY:
return ctx->Extensions.EXT_texture_array;
default:
return false;
}
case 3:
switch (target) {
case GL_PROXY_TEXTURE_3D:
return true;
case GL_PROXY_TEXTURE_2D_ARRAY:
return ctx->Extensions.EXT_texture_array;
case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY:
return ctx->Extensions.ARB_texture_cube_map_array;
default:
return false;
}
default:
unreachable("impossible dimensions");
}
}
/** Helper to get a particular texture image in a texture object */
static struct gl_texture_image *
get_tex_image(struct gl_context *ctx,
struct gl_texture_object *texObj,
GLuint face, GLuint level)
{
const GLenum faceTarget =
(texObj->Target == GL_TEXTURE_CUBE_MAP ||
texObj->Target == GL_PROXY_TEXTURE_CUBE_MAP)
? GL_TEXTURE_CUBE_MAP_POSITIVE_X + face : texObj->Target;
return _mesa_get_tex_image(ctx, texObj, faceTarget, level);
}
static GLboolean
initialize_texture_fields(struct gl_context *ctx,
struct gl_texture_object *texObj,
GLint levels,
GLsizei width, GLsizei height, GLsizei depth,
GLenum internalFormat, mesa_format texFormat)
{
const GLenum target = texObj->Target;
const GLuint numFaces = _mesa_num_tex_faces(target);
GLint level, levelWidth = width, levelHeight = height, levelDepth = depth;
GLuint face;
/* Set up all the texture object's gl_texture_images */
for (level = 0; level < levels; level++) {
for (face = 0; face < numFaces; face++) {
struct gl_texture_image *texImage =
get_tex_image(ctx, texObj, face, level);
if (!texImage) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexStorage");
return GL_FALSE;
}
_mesa_init_teximage_fields(ctx, texImage,
levelWidth, levelHeight, levelDepth,
0, internalFormat, texFormat);
}
_mesa_next_mipmap_level_size(target, 0,
levelWidth, levelHeight, levelDepth,
&levelWidth, &levelHeight, &levelDepth);
}
return GL_TRUE;
}
/**
* Clear all fields of texture object to zeros. Used for proxy texture tests
* and to clean up when a texture memory allocation fails.
*/
static void
clear_texture_fields(struct gl_context *ctx,
struct gl_texture_object *texObj)
{
const GLenum target = texObj->Target;
const GLuint numFaces = _mesa_num_tex_faces(target);
GLint level;
GLuint face;
for (level = 0; level < ARRAY_SIZE(texObj->Image[0]); level++) {
for (face = 0; face < numFaces; face++) {
struct gl_texture_image *texImage =
get_tex_image(ctx, texObj, face, level);
if (!texImage) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexStorage");
return;
}
_mesa_clear_texture_image(ctx, texImage);
}
}
}
/**
* Update/re-validate framebuffer object.
*/
static void
update_fbo_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
{
const unsigned numFaces = _mesa_num_tex_faces(texObj->Target);
for (int level = 0; level < ARRAY_SIZE(texObj->Image[0]); level++) {
for (unsigned face = 0; face < numFaces; face++)
_mesa_update_fbo_texture(ctx, texObj, face, level);
}
}
GLboolean
_mesa_is_legal_tex_storage_format(const struct gl_context *ctx,
GLenum internalformat)
{
/* check internal format - note that only sized formats are allowed */
switch (internalformat) {
case GL_ALPHA:
case GL_LUMINANCE:
case GL_LUMINANCE_ALPHA:
case GL_INTENSITY:
case GL_RED:
case GL_RG:
case GL_RGB:
case GL_RGBA:
case GL_BGRA:
case GL_DEPTH_COMPONENT:
case GL_DEPTH_STENCIL:
case GL_COMPRESSED_ALPHA:
case GL_COMPRESSED_LUMINANCE_ALPHA:
case GL_COMPRESSED_LUMINANCE:
case GL_COMPRESSED_INTENSITY:
case GL_COMPRESSED_RGB:
case GL_COMPRESSED_RGBA:
case GL_COMPRESSED_SRGB:
case GL_COMPRESSED_SRGB_ALPHA:
case GL_COMPRESSED_SLUMINANCE:
case GL_COMPRESSED_SLUMINANCE_ALPHA:
case GL_RED_INTEGER:
case GL_GREEN_INTEGER:
case GL_BLUE_INTEGER:
case GL_ALPHA_INTEGER:
case GL_RGB_INTEGER:
case GL_RGBA_INTEGER:
case GL_BGR_INTEGER:
case GL_BGRA_INTEGER:
case GL_LUMINANCE_INTEGER_EXT:
case GL_LUMINANCE_ALPHA_INTEGER_EXT:
/* these unsized formats are illegal */
return GL_FALSE;
default:
return _mesa_base_tex_format(ctx, internalformat) > 0;
}
}
/**
* Default ctx->Driver.AllocTextureStorage() handler.
*
* The driver can override this with a more specific implementation if it
* desires, but this can be used to get the texture images allocated using the
* usual texture image handling code. The immutability of
* GL_ARB_texture_storage texture layouts is handled by texObj->Immutable
* checks at glTexImage* time.
*/
GLboolean
_mesa_AllocTextureStorage_sw(struct gl_context *ctx,
struct gl_texture_object *texObj,
GLsizei levels, GLsizei width,
GLsizei height, GLsizei depth)
{
const int numFaces = _mesa_num_tex_faces(texObj->Target);
int face;
int level;
(void) width;
(void) height;
(void) depth;
for (face = 0; face < numFaces; face++) {
for (level = 0; level < levels; level++) {
struct gl_texture_image *const texImage = texObj->Image[face][level];
if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage))
return GL_FALSE;
}
}
return GL_TRUE;
}
/**
* Do error checking for calls to glTexStorage1/2/3D().
* If an error is found, record it with _mesa_error(), unless the target
* is a proxy texture.
* \return GL_TRUE if any error, GL_FALSE otherwise.
*/
static GLboolean
tex_storage_error_check(struct gl_context *ctx,
struct gl_texture_object *texObj,
struct gl_memory_object *memObj,
GLuint dims, GLenum target,
GLsizei levels, GLenum internalformat,
GLsizei width, GLsizei height, GLsizei depth,
bool dsa)
{
const char* suffix = dsa ? (memObj ? "tureMem" : "ture") :
(memObj ? "Mem" : "");
/* Legal format checking has been moved to texstorage and texturestorage in
* order to allow meta functions to use legacy formats. */
/* size check */
if (!_mesa_valid_tex_storage_dim(width, height, depth)) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glTex%sStorage%uD(width, height or depth < 1)",
suffix, dims);
return GL_TRUE;
}
if (_mesa_is_compressed_format(ctx, internalformat)) {
GLenum err;
if (!_mesa_target_can_be_compressed(ctx, target, internalformat, &err)) {
_mesa_error(ctx, err,
"glTex%sStorage%dD(internalformat = %s)", suffix, dims,
_mesa_enum_to_string(internalformat));
return GL_TRUE;
}
}
/* levels check */
if (levels < 1) {
_mesa_error(ctx, GL_INVALID_VALUE, "glTex%sStorage%uD(levels < 1)",
suffix, dims);
return GL_TRUE;
}
/* check levels against maximum (note different error than above) */
if (levels > (GLint) _mesa_max_texture_levels(ctx, target)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glTex%sStorage%uD(levels too large)",
suffix, dims);
return GL_TRUE;
}
/* check levels against width/height/depth */
if (levels > _mesa_get_tex_max_num_levels(target, width, height, depth)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glTex%sStorage%uD(too many levels"
" for max texture dimension)",
suffix, dims);
return GL_TRUE;
}
/* non-default texture object check */
if (!_mesa_is_proxy_texture(target) && (!texObj || (texObj->Name == 0))) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glTex%sStorage%uD(texture object 0)",
suffix, dims);
return GL_TRUE;
}
/* Check if texObj->Immutable is set */
if (!_mesa_is_proxy_texture(target) && texObj->Immutable) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glTex%sStorage%uD(immutable)",
suffix, dims);
return GL_TRUE;
}
/* additional checks for depth textures */
if (!_mesa_legal_texture_base_format_for_target(ctx, target, internalformat)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glTex%sStorage%uD(bad target for texture)",
suffix, dims);
return GL_TRUE;
}
return GL_FALSE;
}
/**
* Helper that does the storage allocation for _mesa_TexStorage1/2/3D()
* and _mesa_TextureStorage1/2/3D().
*/
static ALWAYS_INLINE void
texture_storage(struct gl_context *ctx, GLuint dims,
struct gl_texture_object *texObj,
struct gl_memory_object *memObj, GLenum target,
GLsizei levels, GLenum internalformat, GLsizei width,
GLsizei height, GLsizei depth, GLuint64 offset, bool dsa,
bool no_error)
{
GLboolean sizeOK = GL_TRUE, dimensionsOK = GL_TRUE;
mesa_format texFormat;
const char* suffix = dsa ? (memObj ? "tureMem" : "ture") :
(memObj ? "Mem" : "");
assert(texObj);
if (!no_error) {
if (tex_storage_error_check(ctx, texObj, memObj, dims, target, levels,
internalformat, width, height, depth, dsa)) {
return; /* error was recorded */
}
}
texFormat = _mesa_choose_texture_format(ctx, texObj, target, 0,
internalformat, GL_NONE, GL_NONE);
if (!no_error) {
/* check that width, height, depth are legal for the mipmap level */
dimensionsOK = _mesa_legal_texture_dimensions(ctx, target, 0,
width, height, depth, 0);
sizeOK = ctx->Driver.TestProxyTexImage(ctx, target, levels, 0, texFormat,
1, width, height, depth);
}
if (_mesa_is_proxy_texture(target)) {
if (dimensionsOK && sizeOK) {
initialize_texture_fields(ctx, texObj, levels, width, height, depth,
internalformat, texFormat);
}
else {
/* clear all image fields for [levels] */
clear_texture_fields(ctx, texObj);
}
}
else {
if (!no_error) {
if (!dimensionsOK) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glTex%sStorage%uD(invalid width, height or depth)",
suffix, dims);
return;
}
if (!sizeOK) {
_mesa_error(ctx, GL_OUT_OF_MEMORY,
"glTex%sStorage%uD(texture too large)",
suffix, dims);
return;
}
}
assert(levels > 0);
assert(width > 0);
assert(height > 0);
assert(depth > 0);
if (!initialize_texture_fields(ctx, texObj, levels, width, height, depth,
internalformat, texFormat)) {
return;
}
/* Setup the backing memory */
if (memObj) {
if (!ctx->Driver.SetTextureStorageForMemoryObject(ctx, texObj, memObj,
levels,
width, height, depth,
offset)) {
clear_texture_fields(ctx, texObj);
return;
}
}
else {
if (!ctx->Driver.AllocTextureStorage(ctx, texObj, levels,
width, height, depth)) {
/* Reset the texture images' info to zeros.
* Strictly speaking, we probably don't have to do this since
* generating GL_OUT_OF_MEMORY can leave things in an undefined
* state but this puts things in a consistent state.
*/
clear_texture_fields(ctx, texObj);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTex%sStorage%uD",
suffix, dims);
return;
}
}
_mesa_set_texture_view_state(ctx, texObj, target, levels);
update_fbo_texture(ctx, texObj);
}
}
static void
texture_storage_error(struct gl_context *ctx, GLuint dims,
struct gl_texture_object *texObj,
GLenum target, GLsizei levels,
GLenum internalformat, GLsizei width,
GLsizei height, GLsizei depth, bool dsa)
{
texture_storage(ctx, dims, texObj, NULL, target, levels, internalformat,
width, height, depth, dsa, 0, false);
}
static void
texture_storage_no_error(struct gl_context *ctx, GLuint dims,
struct gl_texture_object *texObj,
GLenum target, GLsizei levels,
GLenum internalformat, GLsizei width,
GLsizei height, GLsizei depth, bool dsa)
{
texture_storage(ctx, dims, texObj, NULL, target, levels, internalformat,
width, height, depth, dsa, 0, true);
}
/**
* Helper used by _mesa_TexStorage1/2/3D().
*/
static void
texstorage_error(GLuint dims, GLenum target, GLsizei levels,
GLenum internalformat, GLsizei width, GLsizei height,
GLsizei depth, const char *caller)
{
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
/* Check target. This is done here so that texture_storage
* can receive unsized formats.
*/
if (!legal_texobj_target(ctx, dims, target)) {
_mesa_error(ctx, GL_INVALID_ENUM,
"%s(illegal target=%s)",
caller, _mesa_enum_to_string(target));
return;
}
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
_mesa_debug(ctx, "%s %s %d %s %d %d %d\n", caller,
_mesa_enum_to_string(target), levels,
_mesa_enum_to_string(internalformat),
width, height, depth);
/* Check the format to make sure it is sized. */
if (!_mesa_is_legal_tex_storage_format(ctx, internalformat)) {
_mesa_error(ctx, GL_INVALID_ENUM,
"%s(internalformat = %s)", caller,
_mesa_enum_to_string(internalformat));
return;
}
texObj = _mesa_get_current_tex_object(ctx, target);
if (!texObj)
return;
texture_storage_error(ctx, dims, texObj, target, levels,
internalformat, width, height, depth, false);
}
static void
texstorage_no_error(GLuint dims, GLenum target, GLsizei levels,
GLenum internalformat, GLsizei width, GLsizei height,
GLsizei depth)
{
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_object *texObj = _mesa_get_current_tex_object(ctx, target);
texture_storage_no_error(ctx, dims, texObj, target, levels,
internalformat, width, height, depth, false);
}
/**
* Helper used by _mesa_TextureStorage1/2/3D().
*/
static void
texturestorage_error(GLuint dims, GLuint texture, GLsizei levels,
GLenum internalformat, GLsizei width, GLsizei height,
GLsizei depth, const char *caller)
{
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
_mesa_debug(ctx, "%s %d %d %s %d %d %d\n",
caller, texture, levels,
_mesa_enum_to_string(internalformat),
width, height, depth);
/* Check the format to make sure it is sized. */
if (!_mesa_is_legal_tex_storage_format(ctx, internalformat)) {
_mesa_error(ctx, GL_INVALID_ENUM,
"%s(internalformat = %s)", caller,
_mesa_enum_to_string(internalformat));
return;
}
texObj = _mesa_lookup_texture_err(ctx, texture, caller);
if (!texObj)
return;
/* Check target. This is done here so that texture_storage
* can receive unsized formats.
*/
if (!legal_texobj_target(ctx, dims, texObj->Target)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s(illegal target=%s)", caller,
_mesa_enum_to_string(texObj->Target));
return;
}
texture_storage_error(ctx, dims, texObj, texObj->Target,
levels, internalformat, width, height, depth, true);
}
static void
texturestorage_no_error(GLuint dims, GLuint texture, GLsizei levels,
GLenum internalformat, GLsizei width, GLsizei height,
GLsizei depth)
{
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_object *texObj = _mesa_lookup_texture(ctx, texture);
texture_storage_no_error(ctx, dims, texObj, texObj->Target,
levels, internalformat, width, height, depth, true);
}
void GLAPIENTRY
_mesa_TexStorage1D_no_error(GLenum target, GLsizei levels,
GLenum internalformat, GLsizei width)
{
texstorage_no_error(1, target, levels, internalformat, width, 1, 1);
}
void GLAPIENTRY
_mesa_TexStorage1D(GLenum target, GLsizei levels, GLenum internalformat,
GLsizei width)
{
texstorage_error(1, target, levels, internalformat, width, 1, 1,
"glTexStorage1D");
}
void GLAPIENTRY
_mesa_TexStorage2D_no_error(GLenum target, GLsizei levels,
GLenum internalformat, GLsizei width,
GLsizei height)
{
texstorage_no_error(2, target, levels, internalformat, width, height, 1);
}
void GLAPIENTRY
_mesa_TexStorage2D(GLenum target, GLsizei levels, GLenum internalformat,
GLsizei width, GLsizei height)
{
texstorage_error(2, target, levels, internalformat, width, height, 1,
"glTexStorage2D");
}
void GLAPIENTRY
_mesa_TexStorage3D_no_error(GLenum target, GLsizei levels,
GLenum internalformat, GLsizei width,
GLsizei height, GLsizei depth)
{
texstorage_no_error(3, target, levels, internalformat, width, height, depth);
}
void GLAPIENTRY
_mesa_TexStorage3D(GLenum target, GLsizei levels, GLenum internalformat,
GLsizei width, GLsizei height, GLsizei depth)
{
texstorage_error(3, target, levels, internalformat, width, height, depth,
"glTexStorage3D");
}
void GLAPIENTRY
_mesa_TextureStorage1D_no_error(GLuint texture, GLsizei levels,
GLenum internalformat, GLsizei width)
{
texturestorage_no_error(1, texture, levels, internalformat, width, 1, 1);
}
void GLAPIENTRY
_mesa_TextureStorage1D(GLuint texture, GLsizei levels, GLenum internalformat,
GLsizei width)
{
texturestorage_error(1, texture, levels, internalformat, width, 1, 1,
"glTextureStorage1D");
}
void GLAPIENTRY
_mesa_TextureStorage2D_no_error(GLuint texture, GLsizei levels,
GLenum internalformat,
GLsizei width, GLsizei height)
{
texturestorage_no_error(2, texture, levels, internalformat, width, height, 1);
}
void GLAPIENTRY
_mesa_TextureStorage2D(GLuint texture, GLsizei levels,
GLenum internalformat,
GLsizei width, GLsizei height)
{
texturestorage_error(2, texture, levels, internalformat, width, height, 1,
"glTextureStorage2D");
}
void GLAPIENTRY
_mesa_TextureStorage3D_no_error(GLuint texture, GLsizei levels,
GLenum internalformat, GLsizei width,
GLsizei height, GLsizei depth)
{
texturestorage_no_error(3, texture, levels, internalformat, width, height,
depth);
}
void GLAPIENTRY
_mesa_TextureStorage3D(GLuint texture, GLsizei levels, GLenum internalformat,
GLsizei width, GLsizei height, GLsizei depth)
{
texturestorage_error(3, texture, levels, internalformat, width, height, depth,
"glTextureStorage3D");
}
void GLAPIENTRY
_mesa_TextureStorage1DEXT(GLuint texture, GLenum target, GLsizei levels,
GLenum internalformat,
GLsizei width)
{
GET_CURRENT_CONTEXT(ctx);
/* 'texture' must always be initialized, even if the call to
* glTextureStorage1DEXT will generate an error.
*/
if (!_mesa_lookup_or_create_texture(ctx, target, texture, false, true,
"glTextureStorage1DEXT"))
return;
texturestorage_error(1, texture, levels, internalformat, width, 1, 1,
"glTextureStorage1DEXT");
}
void GLAPIENTRY
_mesa_TextureStorage2DEXT(GLuint texture, GLenum target, GLsizei levels,
GLenum internalformat,
GLsizei width, GLsizei height)
{
GET_CURRENT_CONTEXT(ctx);
/* 'texture' must always be initialized, even if the call to
* glTextureStorage2DEXT will generate an error.
*/
if (!_mesa_lookup_or_create_texture(ctx, target, texture, false, true,
"glTextureStorage2DEXT"))
return;
texturestorage_error(2, texture, levels, internalformat, width, height, 1,
"glTextureStorage2DEXT");
}
void GLAPIENTRY
_mesa_TextureStorage3DEXT(GLuint texture, GLenum target, GLsizei levels,
GLenum internalformat,
GLsizei width, GLsizei height, GLsizei depth)
{
GET_CURRENT_CONTEXT(ctx);
/* 'texture' must always be initialized, even if the call to
* glTextureStorage3DEXT will generate an error.
*/
if (!_mesa_lookup_or_create_texture(ctx, target, texture, false, true,
"glTextureStorage3DEXT"))
return;
texturestorage_error(3, texture, levels, internalformat, width, height, depth,
"glTextureStorage3DEXT");
}
void
_mesa_texture_storage_memory(struct gl_context *ctx, GLuint dims,
struct gl_texture_object *texObj,
struct gl_memory_object *memObj,
GLenum target, GLsizei levels,
GLenum internalformat, GLsizei width,
GLsizei height, GLsizei depth,
GLuint64 offset, bool dsa)
{
assert(memObj);
texture_storage(ctx, dims, texObj, memObj, target, levels, internalformat,
width, height, depth, offset, dsa, false);
}
|