+
+/**
+ * Called via the glTexParam*() function, but only when some texture object
+ * state has actually changed.
+ */
+static void
+st_TexParameter(struct gl_context *ctx,
+ struct gl_texture_object *texObj, GLenum pname)
+{
+ struct st_context *st = st_context(ctx);
+ struct st_texture_object *stObj = st_texture_object(texObj);
+
+ switch (pname) {
+ case GL_TEXTURE_BASE_LEVEL:
+ case GL_TEXTURE_MAX_LEVEL:
+ case GL_DEPTH_TEXTURE_MODE:
+ case GL_DEPTH_STENCIL_TEXTURE_MODE:
+ case GL_TEXTURE_SRGB_DECODE_EXT:
+ case GL_TEXTURE_SWIZZLE_R:
+ case GL_TEXTURE_SWIZZLE_G:
+ case GL_TEXTURE_SWIZZLE_B:
+ case GL_TEXTURE_SWIZZLE_A:
+ case GL_TEXTURE_SWIZZLE_RGBA:
+ case GL_TEXTURE_BUFFER_SIZE:
+ case GL_TEXTURE_BUFFER_OFFSET:
+ /* changing any of these texture parameters means we must create
+ * new sampler views.
+ */
+ st_texture_release_all_sampler_views(st, stObj);
+ break;
+ default:
+ ; /* nothing */
+ }
+}
+
+static GLboolean
+st_SetTextureStorageForMemoryObject(struct gl_context *ctx,
+ struct gl_texture_object *texObj,
+ struct gl_memory_object *memObj,
+ GLsizei levels, GLsizei width,
+ GLsizei height, GLsizei depth,
+ GLuint64 offset)
+{
+ return st_texture_storage(ctx, texObj, levels,
+ width, height, depth,
+ memObj, offset);
+}
+
+static GLuint64
+st_NewTextureHandle(struct gl_context *ctx, struct gl_texture_object *texObj,
+ struct gl_sampler_object *sampObj)
+{
+ struct st_context *st = st_context(ctx);
+ struct st_texture_object *stObj = st_texture_object(texObj);
+ struct pipe_context *pipe = st->pipe;
+ struct pipe_sampler_view *view;
+ struct pipe_sampler_state sampler = {0};
+
+ if (texObj->Target != GL_TEXTURE_BUFFER) {
+ if (!st_finalize_texture(ctx, pipe, texObj, 0))
+ return 0;
+
+ st_convert_sampler(st, texObj, sampObj, 0, &sampler);
+ view = st_get_texture_sampler_view_from_stobj(st, stObj, sampObj, 0);
+ } else {
+ view = st_get_buffer_sampler_view_from_stobj(st, stObj);
+ }
+
+ return pipe->create_texture_handle(pipe, view, &sampler);
+}
+
+
+static void
+st_DeleteTextureHandle(struct gl_context *ctx, GLuint64 handle)
+{
+ struct st_context *st = st_context(ctx);
+ struct pipe_context *pipe = st->pipe;
+
+ pipe->delete_texture_handle(pipe, handle);
+}
+
+
+static void
+st_MakeTextureHandleResident(struct gl_context *ctx, GLuint64 handle,
+ bool resident)
+{
+ struct st_context *st = st_context(ctx);
+ struct pipe_context *pipe = st->pipe;
+
+ pipe->make_texture_handle_resident(pipe, handle, resident);
+}
+
+
+static GLuint64
+st_NewImageHandle(struct gl_context *ctx, struct gl_image_unit *imgObj)
+{
+ struct st_context *st = st_context(ctx);
+ struct pipe_context *pipe = st->pipe;
+ struct pipe_image_view image;
+
+ st_convert_image(st, imgObj, &image);
+
+ return pipe->create_image_handle(pipe, &image);
+}
+
+
+static void
+st_DeleteImageHandle(struct gl_context *ctx, GLuint64 handle)
+{
+ struct st_context *st = st_context(ctx);
+ struct pipe_context *pipe = st->pipe;
+
+ pipe->delete_image_handle(pipe, handle);
+}
+
+
+static void
+st_MakeImageHandleResident(struct gl_context *ctx, GLuint64 handle,
+ GLenum access, bool resident)
+{
+ struct st_context *st = st_context(ctx);
+ struct pipe_context *pipe = st->pipe;
+
+ pipe->make_image_handle_resident(pipe, handle, access, resident);
+}
+
+