• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2016 VMware, Inc.
3  * All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sub license, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * The above copyright notice and this permission notice (including the
14  * next paragraph) shall be included in all copies or substantial portions
15  * of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
20  * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
21  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24  */
25 
26 #include "pipe/p_context.h"
27 #include "util/format/u_format.h"
28 #include "util/u_inlines.h"
29 
30 #include "main/context.h"
31 #include "main/macros.h"
32 #include "main/mtypes.h"
33 #include "main/teximage.h"
34 #include "main/texobj.h"
35 #include "program/prog_instruction.h"
36 
37 #include "st_context.h"
38 #include "st_sampler_view.h"
39 #include "st_texture.h"
40 #include "st_format.h"
41 #include "st_cb_texture.h"
42 
43 /* Subtract remaining private references. Typically used before
44  * destruction. See the header file for explanation.
45  */
46 static void
st_remove_private_references(struct st_sampler_view * sv)47 st_remove_private_references(struct st_sampler_view *sv)
48 {
49    if (sv->private_refcount) {
50       assert(sv->private_refcount > 0);
51       p_atomic_add(&sv->view->reference.count, -sv->private_refcount);
52       sv->private_refcount = 0;
53    }
54 }
55 
56 /* Return a sampler view while incrementing the refcount by 1. */
57 static struct pipe_sampler_view *
get_sampler_view_reference(struct st_sampler_view * sv,struct pipe_sampler_view * view)58 get_sampler_view_reference(struct st_sampler_view *sv,
59                            struct pipe_sampler_view *view)
60 {
61    if (unlikely(sv->private_refcount <= 0)) {
62       assert(sv->private_refcount == 0);
63 
64       /* This is the number of atomic increments we will skip. */
65       sv->private_refcount = 100000000;
66       p_atomic_add(&view->reference.count, sv->private_refcount);
67    }
68 
69    /* Return a reference while decrementing the private refcount. */
70    sv->private_refcount--;
71    return view;
72 }
73 
74 /**
75  * Set the given view as the current context's view for the texture.
76  *
77  * Overwrites any pre-existing view of the context.
78  *
79  * Takes ownership of the view (i.e., stores the view without incrementing the
80  * reference count).
81  *
82  * \return the view, or NULL on error. In case of error, the reference to the
83  * view is released.
84  */
85 static struct pipe_sampler_view *
st_texture_set_sampler_view(struct st_context * st,struct gl_texture_object * stObj,struct pipe_sampler_view * view,bool glsl130_or_later,bool srgb_skip_decode,bool get_reference,bool locked)86 st_texture_set_sampler_view(struct st_context *st,
87                             struct gl_texture_object *stObj,
88                             struct pipe_sampler_view *view,
89                             bool glsl130_or_later, bool srgb_skip_decode,
90                             bool get_reference, bool locked)
91 {
92    struct st_sampler_views *views;
93    struct st_sampler_view *free = NULL;
94    struct st_sampler_view *sv;
95    GLuint i;
96 
97    if (!locked)
98       simple_mtx_lock(&stObj->validate_mutex);
99    views = stObj->sampler_views;
100 
101    for (i = 0; i < views->count; ++i) {
102       sv = &views->views[i];
103 
104       /* Is the array entry used ? */
105       if (sv->view) {
106          /* check if the context matches */
107          if (sv->view->context == st->pipe) {
108             st_remove_private_references(sv);
109             pipe_sampler_view_reference(&sv->view, NULL);
110             goto found;
111          }
112       } else {
113          /* Found a free slot, remember that */
114          free = sv;
115       }
116    }
117 
118    /* Couldn't find a slot for our context, create a new one */
119    if (free) {
120       sv = free;
121    } else {
122       if (views->count >= views->max) {
123          /* Allocate a larger container. */
124          unsigned new_max = 2 * views->max;
125          unsigned new_size = sizeof(*views) + new_max * sizeof(views->views[0]);
126 
127          if (new_max < views->max ||
128              new_max > (UINT_MAX - sizeof(*views)) / sizeof(views->views[0])) {
129             pipe_sampler_view_reference(&view, NULL);
130             goto out;
131          }
132 
133          struct st_sampler_views *new_views = malloc(new_size);
134          if (!new_views) {
135             pipe_sampler_view_reference(&view, NULL);
136             goto out;
137          }
138 
139          new_views->count = views->count;
140          new_views->max = new_max;
141          memcpy(&new_views->views[0], &views->views[0],
142                views->count * sizeof(views->views[0]));
143 
144          /* Initialize the pipe_sampler_view pointers to zero so that we don't
145           * have to worry about racing against readers when incrementing
146           * views->count.
147           */
148          memset(&new_views->views[views->count], 0,
149                 (new_max - views->count) * sizeof(views->views[0]));
150 
151          /* Use memory release semantics to ensure that concurrent readers will
152           * get the correct contents of the new container.
153           *
154           * Also, the write should be atomic, but that's guaranteed anyway on
155           * all supported platforms.
156           */
157          p_atomic_set(&stObj->sampler_views, new_views);
158 
159          /* We keep the old container around until the texture object is
160           * deleted, because another thread may still be reading from it. We
161           * double the size of the container each time, so we end up with
162           * at most twice the total memory allocation.
163           */
164          views->next = stObj->sampler_views_old;
165          stObj->sampler_views_old = views;
166 
167          views = new_views;
168       }
169 
170       sv = &views->views[views->count];
171 
172       /* Since modification is guarded by the lock, only the write part of the
173        * increment has to be atomic, and that's already guaranteed on all
174        * supported platforms without using an atomic intrinsic.
175        */
176       views->count++;
177    }
178 
179 found:
180    assert(sv->view == NULL);
181 
182    sv->glsl130_or_later = glsl130_or_later;
183    sv->srgb_skip_decode = srgb_skip_decode;
184    sv->view = view;
185    sv->st = st;
186 
187    if (get_reference)
188       view = get_sampler_view_reference(sv, view);
189 
190 out:
191    if (!locked)
192       simple_mtx_unlock(&stObj->validate_mutex);
193    return view;
194 }
195 
196 
197 /**
198  * Return the most-recently validated sampler view for the texture \p stObj
199  * in the given context, if any.
200  *
201  * Performs no additional validation.
202  */
203 struct st_sampler_view *
st_texture_get_current_sampler_view(const struct st_context * st,const struct gl_texture_object * stObj)204 st_texture_get_current_sampler_view(const struct st_context *st,
205                                     const struct gl_texture_object *stObj)
206 {
207    struct st_sampler_views *views = p_atomic_read(&stObj->sampler_views);
208 
209    for (unsigned i = 0; i < views->count; ++i) {
210       struct st_sampler_view *sv = &views->views[i];
211       if (sv->view && sv->view->context == st->pipe)
212          return sv;
213    }
214 
215    return NULL;
216 }
217 
218 
219 /**
220  * For the given texture object, release any sampler views which belong
221  * to the calling context.  This is used to free any sampler views
222  * which belong to the context before the context is destroyed.
223  */
224 void
st_texture_release_context_sampler_view(struct st_context * st,struct gl_texture_object * stObj)225 st_texture_release_context_sampler_view(struct st_context *st,
226                                         struct gl_texture_object *stObj)
227 {
228    GLuint i;
229 
230    simple_mtx_lock(&stObj->validate_mutex);
231    struct st_sampler_views *views = stObj->sampler_views;
232    for (i = 0; i < views->count; ++i) {
233       struct st_sampler_view *sv = &views->views[i];
234 
235       if (sv->view && sv->view->context == st->pipe) {
236          st_remove_private_references(sv);
237          pipe_sampler_view_reference(&sv->view, NULL);
238          break;
239       }
240    }
241    simple_mtx_unlock(&stObj->validate_mutex);
242 }
243 
244 
245 /**
246  * Release all sampler views attached to the given texture object, regardless
247  * of the context.  This is called fairly frequently.  For example, whenever
248  * the texture's base level, max level or swizzle change.
249  */
250 void
st_texture_release_all_sampler_views(struct st_context * st,struct gl_texture_object * stObj)251 st_texture_release_all_sampler_views(struct st_context *st,
252                                      struct gl_texture_object *stObj)
253 {
254    /* TODO: This happens while a texture is deleted, because the Driver API
255     * is asymmetric: the driver allocates the texture object memory, but
256     * mesa/main frees it.
257     */
258    if (!stObj->sampler_views)
259       return;
260 
261    simple_mtx_lock(&stObj->validate_mutex);
262    struct st_sampler_views *views = stObj->sampler_views;
263    for (unsigned i = 0; i < views->count; ++i) {
264       struct st_sampler_view *stsv = &views->views[i];
265       if (stsv->view) {
266          st_remove_private_references(stsv);
267 
268          if (stsv->st && stsv->st != st) {
269             /* Transfer this reference to the zombie list.  It will
270              * likely be freed when the zombie list is freed.
271              */
272             st_save_zombie_sampler_view(stsv->st, stsv->view);
273             stsv->view = NULL;
274          } else {
275             pipe_sampler_view_reference(&stsv->view, NULL);
276          }
277       }
278    }
279    views->count = 0;
280    simple_mtx_unlock(&stObj->validate_mutex);
281 }
282 
283 
284 /*
285  * Delete the texture's sampler views and st_sampler_views containers.
286  * This is to be called just before a texture is deleted.
287  */
288 void
st_delete_texture_sampler_views(struct st_context * st,struct gl_texture_object * stObj)289 st_delete_texture_sampler_views(struct st_context *st,
290                                 struct gl_texture_object *stObj)
291 {
292    st_texture_release_all_sampler_views(st, stObj);
293 
294    /* Free the container of the current per-context sampler views */
295    assert(stObj->sampler_views->count == 0);
296    free(stObj->sampler_views);
297    stObj->sampler_views = NULL;
298 
299    /* Free old sampler view containers */
300    while (stObj->sampler_views_old) {
301       struct st_sampler_views *views = stObj->sampler_views_old;
302       stObj->sampler_views_old = views->next;
303       free(views);
304    }
305 }
306 
307 /**
308  * Return TRUE if the texture's sampler view swizzle is not equal to
309  * the texture's swizzle.
310  *
311  * \param texObj  the st texture object,
312  */
313 ASSERTED static bool
check_sampler_swizzle(const struct st_context * st,const struct gl_texture_object * texObj,const struct pipe_sampler_view * sv,bool glsl130_or_later)314 check_sampler_swizzle(const struct st_context *st,
315                       const struct gl_texture_object *texObj,
316                       const struct pipe_sampler_view *sv,
317                       bool glsl130_or_later)
318 {
319    unsigned swizzle = glsl130_or_later ? texObj->SwizzleGLSL130 : texObj->Swizzle;
320 
321    return ((sv->swizzle_r != GET_SWZ(swizzle, 0)) ||
322            (sv->swizzle_g != GET_SWZ(swizzle, 1)) ||
323            (sv->swizzle_b != GET_SWZ(swizzle, 2)) ||
324            (sv->swizzle_a != GET_SWZ(swizzle, 3)));
325 }
326 
327 
328 static unsigned
last_level(const struct gl_texture_object * texObj)329 last_level(const struct gl_texture_object *texObj)
330 {
331    unsigned ret = MIN2(texObj->Attrib.MinLevel + texObj->_MaxLevel,
332                        texObj->pt->last_level);
333    if (texObj->Immutable)
334       ret = MIN2(ret, texObj->Attrib.MinLevel +
335                  texObj->Attrib.NumLevels - 1);
336    return ret;
337 }
338 
339 
340 static unsigned
last_layer(const struct gl_texture_object * texObj)341 last_layer(const struct gl_texture_object *texObj)
342 {
343    if (texObj->Immutable && texObj->pt->array_size > 1)
344       return MIN2(texObj->Attrib.MinLayer +
345                   texObj->Attrib.NumLayers - 1,
346                   texObj->pt->array_size - 1);
347    return texObj->pt->array_size - 1;
348 }
349 
350 
351 /**
352  * Determine the format for the texture sampler view.
353  */
354 enum pipe_format
st_get_sampler_view_format(const struct st_context * st,const struct gl_texture_object * texObj,bool srgb_skip_decode)355 st_get_sampler_view_format(const struct st_context *st,
356                            const struct gl_texture_object *texObj,
357                            bool srgb_skip_decode)
358 {
359    enum pipe_format format;
360 
361    GLenum baseFormat = _mesa_base_tex_image(texObj)->_BaseFormat;
362    format = texObj->surface_based ? texObj->surface_format : texObj->pt->format;
363 
364    /* From OpenGL 4.3 spec, "Combined Depth/Stencil Textures":
365     *
366     *    "The DEPTH_STENCIL_TEXTURE_MODE is ignored for non
367     *     depth/stencil textures.
368     */
369    const bool has_combined_ds =
370       baseFormat == GL_DEPTH_STENCIL;
371 
372    if (baseFormat == GL_DEPTH_COMPONENT ||
373        baseFormat == GL_DEPTH_STENCIL ||
374        baseFormat == GL_STENCIL_INDEX) {
375       if ((texObj->StencilSampling && has_combined_ds) ||
376           baseFormat == GL_STENCIL_INDEX)
377          format = util_format_stencil_only(format);
378 
379       return format;
380    }
381 
382    /* If sRGB decoding is off, use the linear format */
383    if (srgb_skip_decode)
384       format = util_format_linear(format);
385 
386    /* if resource format matches then YUV wasn't lowered */
387    if (format == texObj->pt->format)
388       return format;
389 
390    /* Use R8_UNORM for video formats */
391    switch (format) {
392    case PIPE_FORMAT_NV12:
393       if (texObj->pt->format == PIPE_FORMAT_R8_G8B8_420_UNORM) {
394          format = PIPE_FORMAT_R8_G8B8_420_UNORM;
395          break;
396       }
397       FALLTHROUGH;
398    case PIPE_FORMAT_NV21:
399       if (texObj->pt->format == PIPE_FORMAT_R8_B8G8_420_UNORM) {
400          format = PIPE_FORMAT_R8_B8G8_420_UNORM;
401          break;
402       }
403       FALLTHROUGH;
404    case PIPE_FORMAT_IYUV:
405       if (texObj->pt->format == PIPE_FORMAT_R8_G8_B8_420_UNORM ||
406           texObj->pt->format == PIPE_FORMAT_R8_B8_G8_420_UNORM) {
407          format = texObj->pt->format;
408          break;
409       }
410       format = PIPE_FORMAT_R8_UNORM;
411       break;
412    case PIPE_FORMAT_P010:
413    case PIPE_FORMAT_P012:
414    case PIPE_FORMAT_P016:
415    case PIPE_FORMAT_P030:
416       format = PIPE_FORMAT_R16_UNORM;
417       break;
418    case PIPE_FORMAT_Y210:
419    case PIPE_FORMAT_Y212:
420    case PIPE_FORMAT_Y216:
421       format = PIPE_FORMAT_R16G16_UNORM;
422       break;
423    case PIPE_FORMAT_Y410:
424       format = PIPE_FORMAT_R10G10B10A2_UNORM;
425       break;
426    case PIPE_FORMAT_Y412:
427    case PIPE_FORMAT_Y416:
428       format = PIPE_FORMAT_R16G16B16A16_UNORM;
429       break;
430    case PIPE_FORMAT_YUYV:
431    case PIPE_FORMAT_YVYU:
432    case PIPE_FORMAT_UYVY:
433    case PIPE_FORMAT_VYUY:
434       if (texObj->pt->format == PIPE_FORMAT_R8G8_R8B8_UNORM ||
435           texObj->pt->format == PIPE_FORMAT_R8B8_R8G8_UNORM ||
436           texObj->pt->format == PIPE_FORMAT_B8R8_G8R8_UNORM ||
437           texObj->pt->format == PIPE_FORMAT_G8R8_B8R8_UNORM) {
438          format = texObj->pt->format;
439          break;
440       }
441       format = PIPE_FORMAT_R8G8_UNORM;
442       break;
443    case PIPE_FORMAT_AYUV:
444       format = PIPE_FORMAT_RGBA8888_UNORM;
445       break;
446    case PIPE_FORMAT_XYUV:
447       format = PIPE_FORMAT_RGBX8888_UNORM;
448       break;
449    default:
450       break;
451    }
452    return format;
453 }
454 
455 
456 static struct pipe_sampler_view *
st_create_texture_sampler_view_from_stobj(struct st_context * st,struct gl_texture_object * texObj,enum pipe_format format,bool glsl130_or_later)457 st_create_texture_sampler_view_from_stobj(struct st_context *st,
458                                           struct gl_texture_object *texObj,
459                                           enum pipe_format format,
460                                           bool glsl130_or_later)
461 {
462    /* There is no need to clear this structure (consider CPU overhead). */
463    struct pipe_sampler_view templ;
464    unsigned swizzle = glsl130_or_later ? texObj->SwizzleGLSL130 : texObj->Swizzle;
465 
466    templ.format = format;
467    templ.is_tex2d_from_buf = false;
468 
469    if (texObj->level_override >= 0) {
470       templ.u.tex.first_level = templ.u.tex.last_level = texObj->level_override;
471    } else {
472       templ.u.tex.first_level = texObj->Attrib.MinLevel +
473                                 texObj->Attrib.BaseLevel;
474       templ.u.tex.last_level = last_level(texObj);
475    }
476    if (texObj->layer_override >= 0) {
477       templ.u.tex.first_layer = templ.u.tex.last_layer = texObj->layer_override;
478    } else {
479       templ.u.tex.first_layer = texObj->Attrib.MinLayer;
480       templ.u.tex.last_layer = last_layer(texObj);
481    }
482    assert(templ.u.tex.first_layer <= templ.u.tex.last_layer);
483    assert(templ.u.tex.first_level <= templ.u.tex.last_level);
484    templ.target = gl_target_to_pipe(texObj->Target);
485 
486    templ.swizzle_r = GET_SWZ(swizzle, 0);
487    templ.swizzle_g = GET_SWZ(swizzle, 1);
488    templ.swizzle_b = GET_SWZ(swizzle, 2);
489    templ.swizzle_a = GET_SWZ(swizzle, 3);
490 
491    return st->pipe->create_sampler_view(st->pipe, texObj->pt, &templ);
492 }
493 
494 struct pipe_sampler_view *
st_get_texture_sampler_view_from_stobj(struct st_context * st,struct gl_texture_object * texObj,const struct gl_sampler_object * samp,bool glsl130_or_later,bool ignore_srgb_decode,bool get_reference)495 st_get_texture_sampler_view_from_stobj(struct st_context *st,
496                                        struct gl_texture_object *texObj,
497                                        const struct gl_sampler_object *samp,
498                                        bool glsl130_or_later,
499                                        bool ignore_srgb_decode,
500                                        bool get_reference)
501 {
502    struct st_sampler_view *sv;
503    bool srgb_skip_decode = false;
504 
505    if (!ignore_srgb_decode && samp->Attrib.sRGBDecode == GL_SKIP_DECODE_EXT)
506       srgb_skip_decode = true;
507 
508    simple_mtx_lock(&texObj->validate_mutex);
509    sv = st_texture_get_current_sampler_view(st, texObj);
510 
511    if (sv &&
512        sv->glsl130_or_later == glsl130_or_later &&
513        sv->srgb_skip_decode == srgb_skip_decode) {
514       /* Debug check: make sure that the sampler view's parameters are
515        * what they're supposed to be.
516        */
517       struct pipe_sampler_view *view = sv->view;
518       assert(texObj->pt == view->texture);
519       assert(!check_sampler_swizzle(st, texObj, view, glsl130_or_later));
520       assert(st_get_sampler_view_format(st, texObj, srgb_skip_decode) == view->format);
521       assert(gl_target_to_pipe(texObj->Target) == view->target);
522       assert(texObj->level_override >= 0 ||
523              texObj->Attrib.MinLevel +
524              texObj->Attrib.BaseLevel == view->u.tex.first_level);
525       assert(texObj->level_override >= 0 || last_level(texObj) == view->u.tex.last_level);
526       assert(texObj->layer_override >= 0 ||
527              texObj->Attrib.MinLayer == view->u.tex.first_layer);
528       assert(texObj->layer_override >= 0 || last_layer(texObj) == view->u.tex.last_layer);
529       assert(texObj->layer_override < 0 ||
530              (texObj->layer_override == view->u.tex.first_layer &&
531               texObj->layer_override == view->u.tex.last_layer));
532       if (get_reference)
533          view = get_sampler_view_reference(sv, view);
534       simple_mtx_unlock(&texObj->validate_mutex);
535       return view;
536    }
537 
538    /* create new sampler view */
539    enum pipe_format format = st_get_sampler_view_format(st, texObj,
540                                                         srgb_skip_decode);
541    struct pipe_sampler_view *view =
542          st_create_texture_sampler_view_from_stobj(st, texObj, format,
543                                                    glsl130_or_later);
544 
545    view = st_texture_set_sampler_view(st, texObj, view,
546                                       glsl130_or_later, srgb_skip_decode,
547                                       get_reference, true);
548    simple_mtx_unlock(&texObj->validate_mutex);
549 
550    return view;
551 }
552 
553 
554 struct pipe_sampler_view *
st_get_buffer_sampler_view_from_stobj(struct st_context * st,struct gl_texture_object * texObj,bool get_reference)555 st_get_buffer_sampler_view_from_stobj(struct st_context *st,
556                                       struct gl_texture_object *texObj,
557                                       bool get_reference)
558 {
559    struct st_sampler_view *sv;
560    struct gl_buffer_object *stBuf =
561       texObj->BufferObject;
562 
563    if (!stBuf || !stBuf->buffer)
564       return NULL;
565 
566    sv = st_texture_get_current_sampler_view(st, texObj);
567 
568    struct pipe_resource *buf = stBuf->buffer;
569 
570    if (sv) {
571       struct pipe_sampler_view *view = sv->view;
572 
573       if (view->texture == buf) {
574          /* Debug check: make sure that the sampler view's parameters are
575           * what they're supposed to be.
576           */
577          assert(st_mesa_format_to_pipe_format(st,
578                                               texObj->_BufferObjectFormat)
579              == view->format);
580          assert(view->target == PIPE_BUFFER);
581          ASSERTED unsigned base = texObj->BufferOffset;
582          ASSERTED unsigned size = MIN2(buf->width0 - base,
583                            (unsigned) texObj->BufferSize);
584          assert(view->u.buf.offset == base);
585          assert(view->u.buf.size == size);
586          if (get_reference)
587             view = get_sampler_view_reference(sv, view);
588          return view;
589       }
590    }
591 
592    unsigned base = texObj->BufferOffset;
593 
594    if (base >= buf->width0)
595       return NULL;
596 
597    unsigned size = buf->width0 - base;
598    size = MIN2(size, (unsigned)texObj->BufferSize);
599    if (!size)
600       return NULL;
601 
602    /* Create a new sampler view. There is no need to clear the entire
603     * structure (consider CPU overhead).
604     */
605    struct pipe_sampler_view templ;
606 
607    templ.is_tex2d_from_buf = false;
608    templ.format =
609       st_mesa_format_to_pipe_format(st, texObj->_BufferObjectFormat);
610    templ.target = PIPE_BUFFER;
611    templ.swizzle_r = PIPE_SWIZZLE_X;
612    templ.swizzle_g = PIPE_SWIZZLE_Y;
613    templ.swizzle_b = PIPE_SWIZZLE_Z;
614    templ.swizzle_a = PIPE_SWIZZLE_W;
615    templ.u.buf.offset = base;
616    templ.u.buf.size = size;
617 
618    struct pipe_sampler_view *view =
619       st->pipe->create_sampler_view(st->pipe, buf, &templ);
620 
621    view = st_texture_set_sampler_view(st, texObj, view, false, false,
622                                       get_reference, false);
623 
624    return view;
625 }
626