st/mesa: put pipe_screen * into st_context and use it

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7901>
This commit is contained in:
Marek Olšák 2020-11-29 03:27:37 -05:00 committed by Marge Bot
parent d23f45577e
commit a07cb9a1ef
33 changed files with 110 additions and 118 deletions

View file

@ -73,7 +73,7 @@ update_framebuffer_size(struct pipe_framebuffer_state *framebuffer,
static unsigned
framebuffer_quantize_num_samples(struct st_context *st, unsigned num_samples)
{
struct pipe_screen *screen = st->pipe->screen;
struct pipe_screen *screen = st->screen;
int quantized_samples = 0;
unsigned msaa_mode;

View file

@ -57,8 +57,8 @@ update_sample_locations(struct st_context *st)
PIPE_MAX_SAMPLE_LOCATION_GRID_SIZE *
PIPE_MAX_SAMPLE_LOCATION_GRID_SIZE * 32];
st->pipe->screen->get_sample_pixel_grid(
st->pipe->screen, samples, &grid_width, &grid_height);
st->screen->get_sample_pixel_grid(st->screen, samples,
&grid_width, &grid_height);
size = grid_width * grid_height * samples;
/**
@ -90,7 +90,7 @@ update_sample_locations(struct st_context *st)
}
util_sample_locations_flip_y(
st->pipe->screen, st->state.fb_height, samples, locations);
st->screen, st->state.fb_height, samples, locations);
if (!st->state.enable_sample_locations ||
st->state.sample_locations_samples != samples ||

View file

@ -286,7 +286,6 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
const GLfloat *color)
{
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
const float fb_width = (float) st->state.fb_width;
const float fb_height = (float) st->state.fb_height;
const float x0 = (float) x;
@ -306,7 +305,7 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
* it up into chunks.
*/
ASSERTED GLuint maxSize =
pipe->screen->get_param(pipe->screen, PIPE_CAP_MAX_TEXTURE_2D_SIZE);
st->screen->get_param(st->screen, PIPE_CAP_MAX_TEXTURE_2D_SIZE);
assert(width <= (GLsizei) maxSize);
assert(height <= (GLsizei) maxSize);
}
@ -536,8 +535,7 @@ accum_bitmap(struct gl_context *ctx,
static void
init_bitmap_state(struct st_context *st)
{
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
struct pipe_screen *screen = st->screen;
/* This function should only be called once */
assert(!st->bitmap.tex_format);

View file

@ -284,7 +284,7 @@ bufferobj_data(struct gl_context *ctx,
{
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
struct pipe_screen *screen = st->screen;
struct st_buffer_object *st_obj = st_buffer_object(obj);
struct st_memory_object *st_mem_obj = st_memory_object(memObj);
bool is_mapped = _mesa_bufferobj_mapped(obj, MAP_USER);

View file

@ -109,7 +109,7 @@ st_destroy_clear(struct st_context *st)
static inline void
set_fragment_shader(struct st_context *st)
{
struct pipe_screen *pscreen = st->pipe->screen;
struct pipe_screen *pscreen = st->screen;
bool use_nir = PIPE_SHADER_IR_NIR ==
pscreen->get_shader_param(pscreen, PIPE_SHADER_VERTEX,
PIPE_SHADER_CAP_PREFERRED_IR);
@ -163,7 +163,7 @@ make_nir_clear_vertex_shader(struct st_context *st, bool layered)
static inline void
set_vertex_shader(struct st_context *st)
{
struct pipe_screen *pscreen = st->pipe->screen;
struct pipe_screen *pscreen = st->screen;
bool use_nir = PIPE_SHADER_IR_NIR ==
pscreen->get_shader_param(pscreen, PIPE_SHADER_VERTEX,
PIPE_SHADER_CAP_PREFERRED_IR);
@ -197,12 +197,12 @@ static void
set_vertex_shader_layered(struct st_context *st)
{
struct pipe_context *pipe = st->pipe;
struct pipe_screen *pscreen = pipe->screen;
struct pipe_screen *pscreen = st->screen;
bool use_nir = PIPE_SHADER_IR_NIR ==
pscreen->get_shader_param(pscreen, PIPE_SHADER_VERTEX,
PIPE_SHADER_CAP_PREFERRED_IR);
if (!pipe->screen->get_param(pipe->screen, PIPE_CAP_TGSI_INSTANCEID)) {
if (!st->screen->get_param(st->screen, PIPE_CAP_TGSI_INSTANCEID)) {
assert(!"Got layered clear, but VS instancing is unsupported");
set_vertex_shader(st);
return;
@ -210,7 +210,7 @@ set_vertex_shader_layered(struct st_context *st)
if (!st->clear.vs_layered) {
bool vs_layer =
pipe->screen->get_param(pipe->screen, PIPE_CAP_TGSI_VS_LAYER_VIEWPORT);
st->screen->get_param(st->screen, PIPE_CAP_TGSI_VS_LAYER_VIEWPORT);
if (vs_layer) {
st->clear.vs_layered =
use_nir ? make_nir_clear_vertex_shader(st, true)

View file

@ -745,7 +745,6 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
GLboolean write_depth, GLboolean write_stencil)
{
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
struct cso_context *cso = st->cso_context;
const unsigned fb_width = _mesa_geometric_width(ctx->DrawBuffer);
const unsigned fb_height = _mesa_geometric_height(ctx->DrawBuffer);
@ -760,8 +759,8 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
/* XXX if DrawPixels image is larger than max texture size, break
* it up into chunks.
*/
maxSize = pipe->screen->get_param(pipe->screen,
PIPE_CAP_MAX_TEXTURE_2D_SIZE);
maxSize = st->screen->get_param(st->screen,
PIPE_CAP_MAX_TEXTURE_2D_SIZE);
assert(width <= maxSize);
assert(height <= maxSize);
@ -1185,11 +1184,11 @@ get_color_index_fp_variant(struct st_context *st)
* Clamp glDrawPixels width and height to the maximum texture size.
*/
static void
clamp_size(struct pipe_context *pipe, GLsizei *width, GLsizei *height,
clamp_size(struct st_context *st, GLsizei *width, GLsizei *height,
struct gl_pixelstore_attrib *unpack)
{
const int maxSize = pipe->screen->get_param(pipe->screen,
PIPE_CAP_MAX_TEXTURE_2D_SIZE);
const int maxSize = st->screen->get_param(st->screen,
PIPE_CAP_MAX_TEXTURE_2D_SIZE);
if (*width > maxSize) {
if (unpack->RowLength == 0)
@ -1304,7 +1303,6 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
{
void *driver_fp;
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
GLboolean write_stencil = GL_FALSE, write_depth = GL_FALSE;
struct pipe_sampler_view *sv[2] = { NULL };
int num_sampler_view = 1;
@ -1328,7 +1326,7 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
*/
clippedUnpack = *unpack;
unpack = &clippedUnpack;
clamp_size(st->pipe, &width, &height, &clippedUnpack);
clamp_size(st, &width, &height, &clippedUnpack);
if (format == GL_DEPTH_STENCIL)
write_stencil = write_depth = GL_TRUE;
@ -1338,7 +1336,7 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
write_depth = GL_TRUE;
if (write_stencil &&
!pipe->screen->get_param(pipe->screen, PIPE_CAP_SHADER_STENCIL_EXPORT)) {
!st->screen->get_param(st->screen, PIPE_CAP_SHADER_STENCIL_EXPORT)) {
/* software fallback */
draw_stencil_pixels(ctx, x, y, width, height, format, type,
unpack, pixels);
@ -1546,7 +1544,7 @@ blit_copy_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
{
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
struct pipe_screen *screen = st->screen;
struct gl_pixelstore_attrib pack, unpack;
GLint readX, readY, readW, readH, drawX, drawY, drawW, drawH;
@ -1693,7 +1691,7 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
{
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
struct pipe_screen *screen = st->screen;
struct st_renderbuffer *rbRead;
void *driver_fp;
struct pipe_resource *pt;
@ -1720,7 +1718,7 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
/* fallback if the driver can't do stencil exports */
if (type == GL_DEPTH_STENCIL &&
!pipe->screen->get_param(pipe->screen, PIPE_CAP_SHADER_STENCIL_EXPORT)) {
!st->screen->get_param(st->screen, PIPE_CAP_SHADER_STENCIL_EXPORT)) {
st_CopyPixels(ctx, srcx, srcy, width, height, dstx, dsty, GL_STENCIL);
st_CopyPixels(ctx, srcx, srcy, width, height, dstx, dsty, GL_DEPTH);
return;
@ -1728,7 +1726,7 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
/* fallback if the driver can't do stencil exports */
if (type == GL_STENCIL &&
!pipe->screen->get_param(pipe->screen, PIPE_CAP_SHADER_STENCIL_EXPORT)) {
!st->screen->get_param(st->screen, PIPE_CAP_SHADER_STENCIL_EXPORT)) {
copy_stencil_pixels(ctx, srcx, srcy, width, height, dstx, dsty);
return;
}

View file

@ -96,7 +96,7 @@ lookup_shader(struct st_context *st,
const uint *semantic_indexes)
{
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
struct pipe_screen *screen = st->screen;
GLuint i, j;
/* look for existing shader with same attributes */

View file

@ -141,7 +141,7 @@ st_get_egl_image(struct gl_context *ctx, GLeglImageOES image_handle,
bool *native_supported)
{
struct st_context *st = st_context(ctx);
struct pipe_screen *screen = st->pipe->screen;
struct pipe_screen *screen = st->screen;
struct st_manager *smapi =
(struct st_manager *) st->iface.st_context_private;
@ -332,8 +332,8 @@ st_bind_egl_image(struct gl_context *ctx,
pipe_resource_reference(&stObj->pt, stimg->texture);
st_texture_release_all_sampler_views(st, stObj);
pipe_resource_reference(&stImage->pt, stObj->pt);
if (st->pipe->screen->resource_changed)
st->pipe->screen->resource_changed(st->pipe->screen, stImage->pt);
if (st->screen->resource_changed)
st->screen->resource_changed(st->screen, stImage->pt);
stObj->surface_format = stimg->format;
stObj->level_override = stimg->level;

View file

@ -114,7 +114,7 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx,
GLuint width, GLuint height)
{
struct st_context *st = st_context(ctx);
struct pipe_screen *screen = st->pipe->screen;
struct pipe_screen *screen = st->screen;
struct st_renderbuffer *strb = st_renderbuffer(rb);
enum pipe_format format = PIPE_FORMAT_NONE;
struct pipe_resource templ;
@ -702,7 +702,7 @@ static void
st_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
{
struct st_context *st = st_context(ctx);
struct pipe_screen *screen = st->pipe->screen;
struct pipe_screen *screen = st->screen;
const struct gl_renderbuffer_attachment *depth =
&fb->Attachment[BUFFER_DEPTH];
const struct gl_renderbuffer_attachment *stencil =

View file

@ -73,9 +73,9 @@ st_finish(struct st_context *st)
st_flush(st, &fence, PIPE_FLUSH_ASYNC | PIPE_FLUSH_HINT_FINISH);
if (fence) {
st->pipe->screen->fence_finish(st->pipe->screen, NULL, fence,
PIPE_TIMEOUT_INFINITE);
st->pipe->screen->fence_reference(st->pipe->screen, &fence, NULL);
st->screen->fence_finish(st->screen, NULL, fence,
PIPE_TIMEOUT_INFINITE);
st->screen->fence_reference(st->screen, &fence, NULL);
}
st_manager_flush_swapbuffers();

View file

@ -56,8 +56,7 @@ st_memoryobj_free(struct gl_context *ctx,
{
struct st_memory_object *st_obj = st_memory_object(obj);
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
struct pipe_screen *screen = st->screen;
if (st_obj->memory)
screen->memobj_destroy(screen, st_obj->memory);
@ -73,8 +72,7 @@ st_import_memoryobj_fd(struct gl_context *ctx,
{
struct st_memory_object *st_obj = st_memory_object(obj);
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
struct pipe_screen *screen = st->screen;
struct winsys_handle whandle = {
.type = WINSYS_HANDLE_TYPE_FD,
.handle = fd,

View file

@ -61,7 +61,7 @@ st_GetProgrammableSampleCaps(struct gl_context *ctx, const struct gl_framebuffer
GLuint *outBits, GLuint *outWidth, GLuint *outHeight)
{
struct st_context *st = st_context(ctx);
struct pipe_screen *screen = st->pipe->screen;
struct pipe_screen *screen = st->screen;
st_validate_state(st, ST_PIPELINE_UPDATE_FRAMEBUFFER);

View file

@ -331,7 +331,7 @@ st_GetPerfMonitorResult(struct gl_context *ctx,
bool
st_have_perfmon(struct st_context *st)
{
struct pipe_screen *screen = st->pipe->screen;
struct pipe_screen *screen = st->screen;
if (!screen->get_driver_query_info || !screen->get_driver_query_group_info)
return false;
@ -344,7 +344,7 @@ st_InitPerfMonitorGroups(struct gl_context *ctx)
{
struct st_context *st = st_context(ctx);
struct gl_perf_monitor_state *perfmon = &ctx->PerfMonitor;
struct pipe_screen *screen = st->pipe->screen;
struct pipe_screen *screen = st->screen;
struct gl_perf_monitor_group *groups = NULL;
struct st_perf_monitor_group *stgroups = NULL;
int num_counters, num_groups;

View file

@ -151,7 +151,7 @@ st_new_ati_fs(struct gl_context *ctx, struct ati_fragment_shader *curProg)
static void
st_max_shader_compiler_threads(struct gl_context *ctx, unsigned count)
{
struct pipe_screen *screen = st_context(ctx)->pipe->screen;
struct pipe_screen *screen = st_context(ctx)->screen;
if (screen->set_max_shader_compiler_threads)
screen->set_max_shader_compiler_threads(screen, count);
@ -161,7 +161,7 @@ static bool
st_get_shader_program_completion_status(struct gl_context *ctx,
struct gl_shader_program *shprog)
{
struct pipe_screen *screen = st_context(ctx)->pipe->screen;
struct pipe_screen *screen = st_context(ctx)->screen;
if (!screen->is_parallel_shader_compilation_finished)
return true;

View file

@ -373,7 +373,7 @@ static uint64_t
st_GetTimestamp(struct gl_context *ctx)
{
struct pipe_context *pipe = st_context(ctx)->pipe;
struct pipe_screen *screen = pipe->screen;
struct pipe_screen *screen = st_context(ctx)->screen;
/* Prefer the per-screen function */
if (screen->get_timestamp) {

View file

@ -102,7 +102,7 @@ try_pbo_readpixels(struct st_context *st, struct st_renderbuffer *strb,
const struct gl_pixelstore_attrib *pack, void *pixels)
{
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
struct pipe_screen *screen = st->screen;
struct cso_context *cso = st->cso_context;
struct pipe_surface *surface = strb->surface;
struct pipe_resource *texture = strb->texture;
@ -271,8 +271,7 @@ blit_to_staging(struct st_context *st, struct st_renderbuffer *strb,
GLenum format,
enum pipe_format src_format, enum pipe_format dst_format)
{
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
struct pipe_screen *screen = st->screen;
struct pipe_resource dst_templ;
struct pipe_resource *dst;
struct pipe_blit_info blit;
@ -413,7 +412,7 @@ st_ReadPixels(struct gl_context *ctx, GLint x, GLint y,
_mesa_get_read_renderbuffer_for_format(ctx, format);
struct st_renderbuffer *strb = st_renderbuffer(rb);
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
struct pipe_screen *screen = st->screen;
struct pipe_resource *src;
struct pipe_resource *dst = NULL;
enum pipe_format dst_format, src_format;

View file

@ -43,7 +43,7 @@ static const GLubyte *
st_get_string(struct gl_context * ctx, GLenum name)
{
struct st_context *st = st_context(ctx);
struct pipe_screen *screen = st->pipe->screen;
struct pipe_screen *screen = st->screen;
switch (name) {
case GL_VENDOR: {

View file

@ -57,7 +57,7 @@ static struct gl_sync_object *st_new_sync_object(struct gl_context *ctx)
static void st_delete_sync_object(struct gl_context *ctx,
struct gl_sync_object *obj)
{
struct pipe_screen *screen = st_context(ctx)->pipe->screen;
struct pipe_screen *screen = st_context(ctx)->screen;
struct st_sync_object *so = (struct st_sync_object*)obj;
screen->fence_reference(screen, &so->fence, NULL);
@ -84,7 +84,7 @@ static void st_client_wait_sync(struct gl_context *ctx,
GLbitfield flags, GLuint64 timeout)
{
struct pipe_context *pipe = st_context(ctx)->pipe;
struct pipe_screen *screen = pipe->screen;
struct pipe_screen *screen = st_context(ctx)->screen;
struct st_sync_object *so = (struct st_sync_object*)obj;
struct pipe_fence_handle *fence = NULL;
@ -133,7 +133,7 @@ static void st_server_wait_sync(struct gl_context *ctx,
GLbitfield flags, GLuint64 timeout)
{
struct pipe_context *pipe = st_context(ctx)->pipe;
struct pipe_screen *screen = pipe->screen;
struct pipe_screen *screen = st_context(ctx)->screen;
struct st_sync_object *so = (struct st_sync_object*)obj;
struct pipe_fence_handle *fence = NULL;

View file

@ -422,7 +422,7 @@ st_UnmapTextureImage(struct gl_context *ctx,
static GLuint
default_bindings(struct st_context *st, enum pipe_format format)
{
struct pipe_screen *screen = st->pipe->screen;
struct pipe_screen *screen = st->screen;
const unsigned target = PIPE_TEXTURE_2D;
unsigned bindings;
@ -1372,7 +1372,7 @@ try_pbo_upload(struct gl_context *ctx, GLuint dims,
struct st_texture_object *stObj = st_texture_object(texImage->TexObject);
struct pipe_resource *texture = stImage->pt;
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
struct pipe_screen *screen = st->screen;
struct pipe_surface *surface = NULL;
struct st_pbo_addresses addr;
enum pipe_format src_format;
@ -1485,7 +1485,7 @@ st_TexSubImage(struct gl_context *ctx, GLuint dims,
struct st_texture_image *stImage = st_texture_image(texImage);
struct st_texture_object *stObj = st_texture_object(texImage->TexObject);
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
struct pipe_screen *screen = st->screen;
struct pipe_resource *dst = stImage->pt;
struct pipe_resource *src = NULL;
struct pipe_resource src_templ;
@ -1790,7 +1790,7 @@ st_CompressedTexSubImage(struct gl_context *ctx, GLuint dims,
struct st_texture_object *stObj = st_texture_object(texImage->TexObject);
struct pipe_resource *texture = stImage->pt;
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
struct pipe_screen *screen = st->screen;
struct pipe_resource *dst = stImage->pt;
struct pipe_surface *surface = NULL;
struct compressed_pixelstore store;
@ -1968,7 +1968,7 @@ st_GetTexSubImage(struct gl_context * ctx,
{
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
struct pipe_screen *screen = st->screen;
struct st_texture_image *stImage = st_texture_image(texImage);
struct st_texture_object *stObj = st_texture_object(texImage->TexObject);
struct pipe_resource *src = stObj->pt;
@ -2506,7 +2506,7 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
struct st_renderbuffer *strb = st_renderbuffer(rb);
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
struct pipe_screen *screen = st->screen;
struct pipe_blit_info blit;
enum pipe_format dst_format;
GLboolean do_flip = (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP);
@ -2879,7 +2879,7 @@ st_texture_create_from_memory(struct st_context *st,
GLuint bind)
{
struct pipe_resource pt, *newtex;
struct pipe_screen *screen = st->pipe->screen;
struct pipe_screen *screen = st->screen;
assert(target < PIPE_MAX_TEXTURE_TYPES);
assert(width0 > 0);
@ -2939,7 +2939,7 @@ st_texture_storage(struct gl_context *ctx,
struct st_context *st = st_context(ctx);
struct st_texture_object *stObj = st_texture_object(texObj);
struct st_memory_object *smObj = st_memory_object(memObj);
struct pipe_screen *screen = st->pipe->screen;
struct pipe_screen *screen = st->screen;
unsigned ptWidth, bindings;
uint16_t ptHeight, ptDepth, ptLayers;
enum pipe_format fmt;
@ -3063,14 +3063,13 @@ st_TestProxyTexImage(struct gl_context *ctx, GLenum target,
GLint width, GLint height, GLint depth)
{
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
if (width == 0 || height == 0 || depth == 0) {
/* zero-sized images are legal, and always fit! */
return GL_TRUE;
}
if (pipe->screen->can_create_resource) {
if (st->screen->can_create_resource) {
/* Ask the gallium driver if the texture is too large */
struct gl_texture_object *texObj =
_mesa_get_current_tex_object(ctx, target);
@ -3104,7 +3103,7 @@ st_TestProxyTexImage(struct gl_context *ctx, GLenum target,
pt.last_level = util_logbase2(MAX3(width, height, depth));
}
return pipe->screen->can_create_resource(pipe->screen, &pt);
return st->screen->can_create_resource(st->screen, &pt);
}
else {
/* Use core Mesa fallback */

View file

@ -122,7 +122,7 @@ st_Enable(struct gl_context *ctx, GLenum cap, UNUSED GLboolean state)
static void
st_query_memory_info(struct gl_context *ctx, struct gl_memory_info *out)
{
struct pipe_screen *screen = st_context(ctx)->pipe->screen;
struct pipe_screen *screen = st_context(ctx)->screen;
struct pipe_memory_info info;
assert(screen->query_memory_info);
@ -464,7 +464,7 @@ st_destroy_context_priv(struct st_context *st, bool destroy_pipe)
/* free glReadPixels cache data */
st_invalidate_readpix_cache(st);
util_throttle_deinit(st->pipe->screen, &st->throttle);
util_throttle_deinit(st->screen, &st->throttle);
cso_destroy_context(st->cso_context);
@ -580,8 +580,10 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe,
ctx->st = st;
st->ctx = ctx;
st->screen = pipe->screen;
st->pipe = pipe;
st->dirty = ST_ALL_STATES_MASK;
st->screen = screen;
st->can_bind_const_buffer_as_vertex =
screen->get_param(screen, PIPE_CAP_CAN_BIND_CONST_BUFFER_AS_VERTEX);
@ -613,7 +615,7 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe,
st_init_pbo_helpers(st);
/* Choose texture target for glDrawPixels, glBitmap, renderbuffers */
if (pipe->screen->get_param(pipe->screen, PIPE_CAP_NPOT_TEXTURES))
if (screen->get_param(screen, PIPE_CAP_NPOT_TEXTURES))
st->internal_target = PIPE_TEXTURE_2D;
else
st->internal_target = PIPE_TEXTURE_RECT;
@ -714,8 +716,8 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe,
PIPE_CAP_MAX_TEXTURE_UPLOAD_MEMORY_BUDGET));
/* GL limits and extensions */
st_init_limits(pipe->screen, &ctx->Const, &ctx->Extensions);
st_init_extensions(pipe->screen, &ctx->Const,
st_init_limits(screen, &ctx->Const, &ctx->Extensions);
st_init_extensions(screen, &ctx->Const,
&ctx->Extensions, &st->options, ctx->API);
/* FIXME: add support for geometry and tessellation shaders for
@ -891,7 +893,7 @@ st_set_background_context(struct gl_context *ctx,
static void
st_get_device_uuid(struct gl_context *ctx, char *uuid)
{
struct pipe_screen *screen = st_context(ctx)->pipe->screen;
struct pipe_screen *screen = st_context(ctx)->screen;
assert(GL_UUID_SIZE_EXT >= PIPE_UUID_SIZE);
memset(uuid, 0, GL_UUID_SIZE_EXT);
@ -902,7 +904,7 @@ st_get_device_uuid(struct gl_context *ctx, char *uuid)
static void
st_get_driver_uuid(struct gl_context *ctx, char *uuid)
{
struct pipe_screen *screen = st_context(ctx)->pipe->screen;
struct pipe_screen *screen = st_context(ctx)->screen;
assert(GL_UUID_SIZE_EXT >= PIPE_UUID_SIZE);
memset(uuid, 0, GL_UUID_SIZE_EXT);
@ -1172,7 +1174,7 @@ st_get_nir_compiler_options(struct st_context *st, gl_shader_stage stage)
if (options) {
return options;
} else {
return nir_to_tgsi_get_compiler_options(st->pipe->screen,
return nir_to_tgsi_get_compiler_options(st->screen,
PIPE_SHADER_IR_NIR,
pipe_shader_type_from_mesa(stage));
}

View file

@ -123,7 +123,7 @@ struct st_context
struct st_context_iface iface;
struct gl_context *ctx;
struct pipe_screen *screen;
struct pipe_context *pipe;
struct draw_context *draw; /**< For selection/feedback/rastpos only */
@ -374,7 +374,6 @@ struct st_context
struct st_zombie_shader_node list;
simple_mtx_t mutex;
} zombie_shaders;
};

View file

@ -62,7 +62,7 @@ enum pipe_format
st_mesa_format_to_pipe_format(const struct st_context *st,
mesa_format mesaFormat)
{
struct pipe_screen *screen = st->pipe->screen;
struct pipe_screen *screen = st->screen;
/* The destination RGBA format mustn't be changed, because it's also
* a destination format of the unpack/decompression function.
@ -1101,7 +1101,7 @@ st_choose_format(struct st_context *st, GLenum internalFormat,
unsigned storage_sample_count,
unsigned bindings, bool swap_bytes, bool allow_dxt)
{
struct pipe_screen *screen = st->pipe->screen;
struct pipe_screen *screen = st->screen;
unsigned i;
int j;
enum pipe_format pf;
@ -1215,7 +1215,7 @@ enum pipe_format
st_choose_matching_format(struct st_context *st, unsigned bind,
GLenum format, GLenum type, GLboolean swapBytes)
{
struct pipe_screen *screen = st->pipe->screen;
struct pipe_screen *screen = st->screen;
if (swapBytes && !_mesa_swap_bytes_in_type_enum(&type))
return PIPE_FORMAT_NONE;

View file

@ -138,8 +138,8 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target,
* if not then generate the mipmap by rendering/texturing.
* If that fails, use the software fallback.
*/
if (!st->pipe->screen->get_param(st->pipe->screen,
PIPE_CAP_GENERATE_MIPMAP) ||
if (!st->screen->get_param(st->screen,
PIPE_CAP_GENERATE_MIPMAP) ||
!st->pipe->generate_mipmap(st->pipe, pt, format, baseLevel,
lastLevel, first_layer, last_layer)) {

View file

@ -45,7 +45,7 @@ extern "C" {
GLboolean
st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
{
struct pipe_screen *pscreen = ctx->st->pipe->screen;
struct pipe_screen *pscreen = st_context(ctx)->screen;
enum pipe_shader_ir preferred_ir = (enum pipe_shader_ir)
pscreen->get_shader_param(pscreen, PIPE_SHADER_VERTEX,

View file

@ -348,7 +348,7 @@ st_nir_preprocess(struct st_context *st, struct gl_program *prog,
struct gl_shader_program *shader_program,
gl_shader_stage stage)
{
struct pipe_screen *screen = st->pipe->screen;
struct pipe_screen *screen = st->screen;
const nir_shader_compiler_options *options =
st->ctx->Const.ShaderCompilerOptions[prog->info.stage].NirOptions;
assert(options);
@ -430,7 +430,7 @@ st_glsl_to_nir_post_opts(struct st_context *st, struct gl_program *prog,
struct gl_shader_program *shader_program)
{
nir_shader *nir = prog->nir;
struct pipe_screen *screen = st->pipe->screen;
struct pipe_screen *screen = st->screen;
/* Make a pass over the IR to add state references for any built-in
* uniforms that are used. This has to be done now (during linking).
@ -769,7 +769,7 @@ st_link_nir(struct gl_context *ctx,
nir_remap_dual_slot_attributes(nir, &shader->Program->DualSlotInputs);
NIR_PASS_V(nir, st_nir_lower_wpos_ytransform, shader->Program,
st->pipe->screen);
st->screen);
NIR_PASS_V(nir, nir_lower_system_values);
NIR_PASS_V(nir, nir_lower_compute_system_values, NULL);
@ -957,7 +957,7 @@ st_finalize_nir(struct st_context *st, struct gl_program *prog,
struct gl_shader_program *shader_program,
nir_shader *nir, bool finalize_by_driver)
{
struct pipe_screen *screen = st->pipe->screen;
struct pipe_screen *screen = st->screen;
NIR_PASS_V(nir, nir_split_var_copies);
NIR_PASS_V(nir, nir_lower_var_copies);

View file

@ -6399,7 +6399,7 @@ emit_wpos(struct st_context *st,
struct ureg_program *ureg,
int wpos_transform_const)
{
struct pipe_screen *pscreen = st->pipe->screen;
struct pipe_screen *pscreen = st->screen;
GLfloat adjX = 0.0f;
GLfloat adjY[2] = { 0.0f, 0.0f };
boolean invert = FALSE;
@ -6580,7 +6580,7 @@ st_translate_program(
const ubyte outputSemanticName[],
const ubyte outputSemanticIndex[])
{
struct pipe_screen *screen = st_context(ctx)->pipe->screen;
struct pipe_screen *screen = st_context(ctx)->screen;
struct st_translate *t;
unsigned i;
struct gl_program_constants *frag_const =
@ -6826,7 +6826,7 @@ st_translate_program(
* inconsistency, we insert a U2F.
*/
struct st_context *st = st_context(ctx);
struct pipe_screen *pscreen = st->pipe->screen;
struct pipe_screen *pscreen = st->screen;
assert(procType == PIPE_SHADER_VERTEX);
assert(pscreen->get_shader_param(pscreen, PIPE_SHADER_VERTEX, PIPE_SHADER_CAP_INTEGERS));
(void) pscreen;
@ -7015,7 +7015,7 @@ get_mesa_program_tgsi(struct gl_context *ctx,
struct gl_program *prog;
struct gl_shader_compiler_options *options =
&ctx->Const.ShaderCompilerOptions[shader->Stage];
struct pipe_screen *pscreen = ctx->st->pipe->screen;
struct pipe_screen *pscreen = st_context(ctx)->screen;
enum pipe_shader_type ptarget = pipe_shader_type_from_mesa(shader->Stage);
unsigned skip_merge_registers;
@ -7245,7 +7245,7 @@ has_unsupported_control_flow(exec_list *ir,
GLboolean
st_link_tgsi(struct gl_context *ctx, struct gl_shader_program *prog)
{
struct pipe_screen *pscreen = ctx->st->pipe->screen;
struct pipe_screen *pscreen = st_context(ctx)->screen;
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
struct gl_linked_shader *shader = prog->_LinkedShaders[i];

View file

@ -471,7 +471,7 @@ st_framebuffer_create(struct st_context *st,
* is also expressed by using the same extension flag
*/
if (_mesa_has_EXT_framebuffer_sRGB(st->ctx)) {
struct pipe_screen *screen = st->pipe->screen;
struct pipe_screen *screen = st->screen;
const enum pipe_format srgb_format =
util_format_srgb(stfbi->visual->color_format);
@ -674,9 +674,9 @@ st_context_flush(struct st_context_iface *stctxi, unsigned flags,
st_flush(st, fence, pipe_flags);
if ((flags & ST_FLUSH_WAIT) && fence && *fence) {
st->pipe->screen->fence_finish(st->pipe->screen, NULL, *fence,
st->screen->fence_finish(st->screen, NULL, *fence,
PIPE_TIMEOUT_INFINITE);
st->pipe->screen->fence_reference(st->pipe->screen, fence, NULL);
st->screen->fence_reference(st->screen, fence, NULL);
}
if (flags & ST_FLUSH_FRONT)
@ -973,7 +973,7 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
}
}
st->can_scissor_clear = !!st->pipe->screen->get_param(st->pipe->screen, PIPE_CAP_CLEAR_SCISSORED);
st->can_scissor_clear = !!st->screen->get_param(st->screen, PIPE_CAP_CLEAR_SCISSORED);
st->invalidate_on_gl_viewport =
smapi->get_param(smapi, ST_MANAGER_BROKEN_INVALIDATE);
@ -991,7 +991,7 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
st->iface.state_manager = smapi;
if (st->ctx->IntelBlackholeRender &&
st->pipe->screen->get_param(st->pipe->screen, PIPE_CAP_FRONTEND_NOOP))
st->screen->get_param(st->screen, PIPE_CAP_FRONTEND_NOOP))
st->pipe->set_frontend_noop(st->pipe, st->ctx->IntelBlackholeRender);
*error = ST_CONTEXT_SUCCESS;

View file

@ -714,7 +714,7 @@ emit_wpos(struct st_context *st,
const struct gl_program *program,
struct ureg_program *ureg)
{
struct pipe_screen *pscreen = st->pipe->screen;
struct pipe_screen *pscreen = st->screen;
GLfloat adjX = 0.0f;
GLfloat adjY[2] = { 0.0f, 0.0f };
boolean invert = FALSE;
@ -980,7 +980,7 @@ st_translate_mesa_program(struct gl_context *ctx,
* inconsistency, we insert a U2F.
*/
struct st_context *st = st_context(ctx);
struct pipe_screen *pscreen = st->pipe->screen;
struct pipe_screen *pscreen = st->screen;
assert(procType == PIPE_SHADER_VERTEX);
assert(pscreen->get_shader_param(pscreen, PIPE_SHADER_VERTEX,
PIPE_SHADER_CAP_INTEGERS));

View file

@ -32,7 +32,7 @@ st_nir_finish_builtin_shader(struct st_context *st,
nir_shader *nir)
{
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
struct pipe_screen *screen = st->screen;
gl_shader_stage stage = nir->info.stage;
enum pipe_shader_type sh = pipe_shader_type_from_mesa(stage);

View file

@ -405,7 +405,7 @@ create_fs(struct st_context *st, bool download,
enum pipe_texture_target target,
enum st_pbo_conversion conversion)
{
struct pipe_screen *screen = st->pipe->screen;
struct pipe_screen *screen = st->screen;
const nir_shader_compiler_options *options =
st_get_nir_compiler_options(st, MESA_SHADER_FRAGMENT);
bool pos_is_sysval =
@ -594,8 +594,7 @@ st_pbo_get_download_fs(struct st_context *st, enum pipe_texture_target target,
void
st_init_pbo_helpers(struct st_context *st)
{
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
struct pipe_screen *screen = st->screen;
st->pbo.upload_enabled =
screen->get_param(screen, PIPE_CAP_TEXTURE_BUFFER_OBJECTS) &&

View file

@ -378,7 +378,7 @@ static nir_shader *
st_translate_prog_to_nir(struct st_context *st, struct gl_program *prog,
gl_shader_stage stage)
{
struct pipe_screen *screen = st->pipe->screen;
struct pipe_screen *screen = st->screen;
const struct gl_shader_compiler_options *options =
&st->ctx->Const.ShaderCompilerOptions[stage];
@ -513,9 +513,9 @@ st_translate_vertex_program(struct st_context *st,
/* Translate to NIR if preferred. */
if (PIPE_SHADER_IR_NIR ==
st->pipe->screen->get_shader_param(st->pipe->screen,
PIPE_SHADER_VERTEX,
PIPE_SHADER_CAP_PREFERRED_IR)) {
st->screen->get_shader_param(st->screen,
PIPE_SHADER_VERTEX,
PIPE_SHADER_CAP_PREFERRED_IR)) {
assert(!stp->glsl_to_tgsi);
if (stp->Base.nir)
@ -558,7 +558,7 @@ st_translate_vertex_program(struct st_context *st,
output_semantic_name[num_outputs] = TGSI_SEMANTIC_EDGEFLAG;
output_semantic_index[num_outputs] = 0;
ureg = ureg_create_with_screen(PIPE_SHADER_VERTEX, st->pipe->screen);
ureg = ureg_create_with_screen(PIPE_SHADER_VERTEX, st->screen);
if (ureg == NULL)
return false;
@ -661,7 +661,7 @@ lower_ucp(struct st_context *st,
if (nir->info.outputs_written & VARYING_BIT_CLIP_DIST0)
NIR_PASS_V(nir, nir_lower_clip_disable, ucp_enables);
else {
struct pipe_screen *screen = st->pipe->screen;
struct pipe_screen *screen = st->screen;
bool can_compact = screen->get_param(screen,
PIPE_CAP_NIR_COMPACT_ARRAYS);
bool use_eye = st->ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX] != NULL;
@ -887,9 +887,9 @@ st_translate_fragment_program(struct st_context *st,
/* Translate to NIR. */
if (!stfp->ati_fs &&
PIPE_SHADER_IR_NIR ==
st->pipe->screen->get_shader_param(st->pipe->screen,
PIPE_SHADER_FRAGMENT,
PIPE_SHADER_CAP_PREFERRED_IR)) {
st->screen->get_shader_param(st->screen,
PIPE_SHADER_FRAGMENT,
PIPE_SHADER_CAP_PREFERRED_IR)) {
nir_shader *nir =
st_translate_prog_to_nir(st, &stfp->Base, MESA_SHADER_FRAGMENT);
@ -1134,7 +1134,7 @@ st_translate_fragment_program(struct st_context *st,
}
}
ureg = ureg_create_with_screen(PIPE_SHADER_FRAGMENT, st->pipe->screen);
ureg = ureg_create_with_screen(PIPE_SHADER_FRAGMENT, st->screen);
if (ureg == NULL)
return false;
@ -1321,7 +1321,7 @@ st_create_fp_variant(struct st_context *st,
key->external.lower_ayuv || key->external.lower_xyuv ||
key->external.lower_yuv)) {
st_nir_lower_samplers(pipe->screen, state.ir.nir,
st_nir_lower_samplers(st->screen, state.ir.nir,
stfp->shader_program, &stfp->Base);
nir_lower_tex_options options = {0};
@ -1359,7 +1359,7 @@ st_create_fp_variant(struct st_context *st,
nir_shader_gather_info(state.ir.nir,
nir_shader_get_entrypoint(state.ir.nir));
struct pipe_screen *screen = pipe->screen;
struct pipe_screen *screen = st->screen;
if (screen->finalize_nir)
screen->finalize_nir(screen, state.ir.nir, false);
}
@ -1567,7 +1567,7 @@ st_translate_common_program(struct st_context *st,
struct gl_program *prog = &stp->Base;
enum pipe_shader_type stage =
pipe_shader_type_from_mesa(stp->Base.info.stage);
struct ureg_program *ureg = ureg_create_with_screen(stage, st->pipe->screen);
struct ureg_program *ureg = ureg_create_with_screen(stage, st->screen);
if (ureg == NULL)
return false;

View file

@ -66,7 +66,7 @@ st_texture_create(struct st_context *st,
GLuint bind)
{
struct pipe_resource pt, *newtex;
struct pipe_screen *screen = st->pipe->screen;
struct pipe_screen *screen = st->screen;
assert(target < PIPE_MAX_TEXTURE_TYPES);
assert(width0 > 0);

View file

@ -135,8 +135,8 @@ st_vdpau_resource_from_description(struct gl_context *ctx,
whandle.offset = desc->offset;
whandle.stride = desc->stride;
res = st->pipe->screen->resource_from_handle(st->pipe->screen, &templ, &whandle,
PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE);
res = st->screen->resource_from_handle(st->screen, &templ, &whandle,
PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE);
close(desc->handle);
return res;
@ -188,7 +188,7 @@ st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access,
const void *vdpSurface, GLuint index)
{
struct st_context *st = st_context(ctx);
struct pipe_screen *screen = st->pipe->screen;
struct pipe_screen *screen = st->screen;
struct st_texture_object *stObj = st_texture_object(texObj);
struct st_texture_image *stImage = st_texture_image(texImage);