st/mesa: simplify st->ctx, ctx->st usage in a various places

This commit is contained in:
Brian Paul 2016-02-16 10:22:32 -07:00
parent 5239832cf1
commit a0636157c4
6 changed files with 17 additions and 18 deletions

View file

@ -193,7 +193,7 @@ setup_render_state(struct gl_context *ctx,
key.st = st->has_shareable_shaders ? NULL : st;
key.bitmap = GL_TRUE;
key.clamp_color = st->clamp_frag_color_in_shader &&
st->ctx->Color._ClampFragmentColor;
ctx->Color._ClampFragmentColor;
fpv = st_get_fp_variant(st, st->fp, &key);
@ -482,7 +482,7 @@ accum_bitmap(struct gl_context *ctx,
struct st_context *st = ctx->st;
struct bitmap_cache *cache = st->bitmap.cache;
int px = -999, py = -999;
const GLfloat z = st->ctx->Current.RasterPos[2];
const GLfloat z = ctx->Current.RasterPos[2];
if (width > BITMAP_CACHE_WIDTH ||
height > BITMAP_CACHE_HEIGHT)
@ -493,7 +493,7 @@ accum_bitmap(struct gl_context *ctx,
py = y - cache->ypos;
if (px < 0 || px + width > BITMAP_CACHE_WIDTH ||
py < 0 || py + height > BITMAP_CACHE_HEIGHT ||
!TEST_EQ_4V(st->ctx->Current.RasterColor, cache->color) ||
!TEST_EQ_4V(ctx->Current.RasterColor, cache->color) ||
((fabs(z - cache->zpos) > Z_EPSILON))) {
/* This bitmap would extend beyond cache bounds, or the bitmap
* color is changing
@ -511,7 +511,7 @@ accum_bitmap(struct gl_context *ctx,
cache->ypos = y - py;
cache->zpos = z;
cache->empty = GL_FALSE;
COPY_4FV(cache->color, st->ctx->Current.RasterColor);
COPY_4FV(cache->color, ctx->Current.RasterColor);
}
assert(px != -999);
@ -655,8 +655,7 @@ st_Bitmap(struct gl_context *ctx, GLint x, GLint y,
if (sv) {
draw_bitmap_quad(ctx, x, y, ctx->Current.RasterPos[2],
width, height, sv,
st->ctx->Current.RasterColor);
width, height, sv, ctx->Current.RasterColor);
pipe_sampler_view_reference(&sv, NULL);
}

View file

@ -237,7 +237,7 @@ clear_with_quad(struct gl_context *ctx, unsigned clear_buffers)
blend.rt[i].colormask |= PIPE_MASK_A;
}
if (st->ctx->Color.DitherFlag)
if (ctx->Color.DitherFlag)
blend.dither = 1;
}
cso_set_blend(cso, &blend);

View file

@ -636,7 +636,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
const float tTop = invertTex ? maxYcoord : 0.0f;
const float tBot = invertTex ? 0.0f : maxYcoord;
if (!st_draw_quad(ctx->st, clip_x0, clip_y0, clip_x1, clip_y1, z,
if (!st_draw_quad(st, clip_x0, clip_y0, clip_x1, clip_y1, z,
sLeft, tBot, sRight, tTop, color, 0)) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels");
}
@ -852,7 +852,7 @@ get_color_fp_variant(struct st_context *st)
ctx->Pixel.AlphaScale != 1.0);
key.pixelMaps = ctx->Pixel.MapColorFlag;
key.clamp_color = st->clamp_frag_color_in_shader &&
st->ctx->Color._ClampFragmentColor;
ctx->Color._ClampFragmentColor;
fpv = st_get_fp_variant(st, st->fp, &key);

View file

@ -107,7 +107,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
{
struct st_context *st = ctx->st;
struct pipe_context *pipe = st->pipe;
struct cso_context *cso = ctx->st->cso_context;
struct cso_context *cso = st->cso_context;
struct pipe_resource *vbuffer = NULL;
GLuint i, numTexCoords, numAttribs;
GLboolean emitColor;
@ -165,7 +165,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
/* positions (in clip coords) */
{
const struct gl_framebuffer *fb = st->ctx->DrawBuffer;
const struct gl_framebuffer *fb = ctx->DrawBuffer;
const GLfloat fb_width = (GLfloat)fb->Width;
const GLfloat fb_height = (GLfloat)fb->Height;
@ -260,7 +260,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
/* viewport state: viewport matching window dims */
{
const struct gl_framebuffer *fb = st->ctx->DrawBuffer;
const struct gl_framebuffer *fb = ctx->DrawBuffer;
const GLboolean invert = (st_fb_orientation(fb) == Y_0_TOP);
const GLfloat width = (GLfloat)fb->Width;
const GLfloat height = (GLfloat)fb->Height;

View file

@ -1446,7 +1446,7 @@ try_pbo_upload_common(struct gl_context *ctx,
cb.buffer = NULL;
cb.user_buffer = NULL;
u_upload_data(st->constbuf_uploader, 0, sizeof(constants),
st->ctx->Const.UniformBufferOffsetAlignment,
ctx->Const.UniformBufferOffsetAlignment,
&constants, &cb.buffer_offset, &cb.buffer);
if (!cb.buffer)
goto fail;

View file

@ -283,9 +283,9 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
/* Need these flags:
*/
st->ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
st->ctx->VertexProgram._MaintainTnlProgram = GL_TRUE;
ctx->VertexProgram._MaintainTnlProgram = GL_TRUE;
st->has_stencil_export =
screen->get_param(screen, PIPE_CAP_SHADER_STENCIL_EXPORT);
@ -349,8 +349,8 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
/* called after _mesa_create_context/_mesa_init_point, fix default user
* settable max point size up
*/
st->ctx->Point.MaxSize = MAX2(ctx->Const.MaxPointSize,
ctx->Const.MaxPointSizeAA);
ctx->Point.MaxSize = MAX2(ctx->Const.MaxPointSize,
ctx->Const.MaxPointSizeAA);
/* For vertex shaders, make sure not to emit saturate when SM 3.0 is not supported */
ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].EmitNoSat = !st->has_shader_model3;
@ -472,7 +472,7 @@ void st_destroy_context( struct st_context *st )
pipe_sampler_view_reference(&st->pixel_xfer.pixelmap_sampler_view, NULL);
pipe_resource_reference(&st->pixel_xfer.pixelmap_texture, NULL);
_vbo_DestroyContext(st->ctx);
_vbo_DestroyContext(ctx);
st_destroy_program_variants(st);