/**************************************************************************
- *
+ *
* Copyright 2007 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
* distribute, sub license, 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 (including the
* next paragraph) 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 NON-INFRINGEMENT.
* 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.
- *
+ *
**************************************************************************/
#include <stdio.h>
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
#include "util/u_rect.h"
#include "util/u_math.h"
#include "util/u_memory.h"
+#include "tgsi/tgsi_from_mesa.h"
#define DBG if(0) printf
struct pipe_resource *
st_texture_create(struct st_context *st,
enum pipe_texture_target target,
- enum pipe_format format,
- GLuint last_level,
- GLuint width0,
- GLuint height0,
- GLuint depth0,
+ enum pipe_format format,
+ GLuint last_level,
+ GLuint width0,
+ GLuint height0,
+ GLuint depth0,
GLuint layers,
GLuint nr_samples,
- GLuint bind )
+ GLuint bind)
{
struct pipe_resource pt, *newtex;
struct pipe_screen *screen = st->pipe->screen;
(int) target, util_format_name(format), last_level);
assert(format);
- assert(screen->is_format_supported(screen, format, target, 0,
+ assert(screen->is_format_supported(screen, format, target, 0, 0,
PIPE_BIND_SAMPLER_VIEW));
memset(&pt, 0, sizeof(pt));
/* only set this for OpenGL textures, not renderbuffers */
pt.flags = PIPE_RESOURCE_FLAG_TEXTURING_MORE_LIKELY;
pt.nr_samples = nr_samples;
+ pt.nr_storage_samples = nr_samples;
newtex = screen->resource_create(screen, &pt);
unsigned ptWidth;
uint16_t ptHeight, ptDepth, ptLayers;
- /* Images with borders are never pulled into mipmap textures.
+ /* Images with borders are never pulled into mipmap textures.
*/
- if (image->Border)
+ if (image->Border)
return GL_FALSE;
/* Check if this image's format matches the established texture's format.
*transfer = NULL;
}
+
/**
* For debug only: get/print center pixel in the src resource.
*/
/* find an RGBA texture format */
format = st_choose_format(st, GL_RGBA, GL_NONE, GL_NONE,
- PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW,
- FALSE);
+ PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SAMPLER_VIEW,
+ false, false);
/* create texture for color map/table */
pt = st_texture_create(st, PIPE_TEXTURE_2D, format, 0,
return pt;
}
+
/**
* Destroy bound texture handles for the given stage.
*/
struct pipe_sampler_view *view;
struct pipe_sampler_state sampler = {0};
- if (!st_update_single_texture(st, &view, texUnit, prog->sh.data->Version))
+ /* TODO: Clarify the interaction of ARB_bindless_texture and EXT_texture_sRGB_decode */
+ st_update_single_texture(st, &view, texUnit, prog->sh.data->Version >= 130, true);
+ if (!view)
return 0;
if (view->target != PIPE_BUFFER)
struct pipe_context *pipe = st->pipe;
struct pipe_image_view img;
- st_convert_image_from_unit(st, &img, imgUnit);
+ st_convert_image_from_unit(st, &img, imgUnit, GL_READ_WRITE);
return pipe->create_image_handle(pipe, &img);
}
st_make_bound_samplers_resident(struct st_context *st,
struct gl_program *prog)
{
- enum pipe_shader_type shader = st_shader_stage_to_ptarget(prog->info.stage);
+ enum pipe_shader_type shader = pipe_shader_type_from_mesa(prog->info.stage);
struct st_bound_handles *bound_handles = &st->bound_texture_handles[shader];
struct pipe_context *pipe = st->pipe;
GLuint64 handle;
st_make_bound_images_resident(struct st_context *st,
struct gl_program *prog)
{
- enum pipe_shader_type shader = st_shader_stage_to_ptarget(prog->info.stage);
+ enum pipe_shader_type shader = pipe_shader_type_from_mesa(prog->info.stage);
struct st_bound_handles *bound_handles = &st->bound_image_handles[shader];
struct pipe_context *pipe = st->pipe;
GLuint64 handle;