/* Choose a pixel format for the temp texture which will hold the
* image to draw.
*/
- pipeFormat = st_choose_format(pipe->screen, intFormat, format, type,
+ pipeFormat = st_choose_format(st, intFormat, format, type,
PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW,
FALSE);
assert(pipeFormat != PIPE_FORMAT_NONE);
else {
/* srcFormat can't be used as a texture format */
if (type == GL_DEPTH) {
- texFormat = st_choose_format(screen, GL_DEPTH_COMPONENT,
+ texFormat = st_choose_format(st, GL_DEPTH_COMPONENT,
GL_NONE, GL_NONE, st->internal_target,
sample_count, PIPE_BIND_DEPTH_STENCIL,
FALSE);
}
else {
/* default color format */
- texFormat = st_choose_format(screen, GL_RGBA,
+ texFormat = st_choose_format(st, GL_RGBA,
GL_NONE, GL_NONE, st->internal_target,
sample_count, PIPE_BIND_SAMPLER_VIEW,
FALSE);
GLenum internalFormat,
GLuint width, GLuint height)
{
- struct pipe_screen *screen = st_context(ctx)->pipe->screen;
+ struct st_context *st = st_context(ctx);
struct st_renderbuffer *strb = st_renderbuffer(rb);
enum pipe_format format;
size_t size;
format = PIPE_FORMAT_R16G16B16A16_SNORM;
}
else {
- format = st_choose_renderbuffer_format(screen, internalFormat, 0);
+ format = st_choose_renderbuffer_format(st, internalFormat, 0);
/* Not setting gl_renderbuffer::Format here will cause
* FRAMEBUFFER_UNSUPPORTED and ValidateFramebuffer will not be called.
unsigned i;
for (i = rb->NumSamples; i <= ctx->Const.MaxSamples; i++) {
- format = st_choose_renderbuffer_format(screen, internalFormat, i);
+ format = st_choose_renderbuffer_format(st, internalFormat, i);
if (format != PIPE_FORMAT_NONE) {
rb->NumSamples = i;
}
}
} else {
- format = st_choose_renderbuffer_format(screen, internalFormat, 0);
+ format = st_choose_renderbuffer_format(st, internalFormat, 0);
}
/* Not setting gl_renderbuffer::Format here will cause
pipe_target = gl_target_to_pipe(gl_target);
/* Find the best match for the format+type combo. */
- pipe_format = st_choose_format(pipe->screen, GL_RGBA8, format, type,
+ pipe_format = st_choose_format(st, GL_RGBA8, format, type,
pipe_target, 0, bind, FALSE);
if (pipe_format == PIPE_FORMAT_NONE) {
/* unable to get an rgba format!?! */
* when we're getting called from gl[Copy]TexImage().
*/
enum pipe_format
-st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
+st_choose_format(struct st_context *st, GLenum internalFormat,
GLenum format, GLenum type,
enum pipe_texture_target target, unsigned sample_count,
unsigned bindings, boolean allow_dxt)
{
- GET_CURRENT_CONTEXT(ctx); /* XXX this should be a function parameter */
+ struct pipe_screen *screen = st->pipe->screen;
int i, j;
enum pipe_format pf;
/* can't render to compressed formats at this time */
- if (_mesa_is_compressed_format(ctx, internalFormat)
+ if (_mesa_is_compressed_format(st->ctx, internalFormat)
&& (bindings & ~PIPE_BIND_SAMPLER_VIEW)) {
return PIPE_FORMAT_NONE;
}
* Called by FBO code to choose a PIPE_FORMAT_ for drawing surfaces.
*/
enum pipe_format
-st_choose_renderbuffer_format(struct pipe_screen *screen,
+st_choose_renderbuffer_format(struct st_context *st,
GLenum internalFormat, unsigned sample_count)
{
uint usage;
usage = PIPE_BIND_DEPTH_STENCIL;
else
usage = PIPE_BIND_RENDER_TARGET;
- return st_choose_format(screen, internalFormat, GL_NONE, GL_NONE,
+ return st_choose_format(st, internalFormat, GL_NONE, GL_NONE,
PIPE_TEXTURE_2D, sample_count, usage, FALSE);
}
internalFormat == GL_RGB || internalFormat == GL_RGBA ||
internalFormat == GL_RGB8 || internalFormat == GL_RGBA8 ||
internalFormat == GL_BGRA;
- struct pipe_screen *screen = st_context(ctx)->pipe->screen;
+ struct st_context *st = st_context(ctx);
enum pipe_format pFormat;
unsigned bindings;
bindings |= PIPE_BIND_RENDER_TARGET;
}
- pFormat = st_choose_format(screen, internalFormat, format, type,
+ pFormat = st_choose_format(st, internalFormat, format, type,
PIPE_TEXTURE_2D, 0, bindings, ctx->Mesa_DXTn);
if (pFormat == PIPE_FORMAT_NONE) {
/* try choosing format again, this time without render target bindings */
- pFormat = st_choose_format(screen, internalFormat, format, type,
+ pFormat = st_choose_format(st, internalFormat, format, type,
PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW,
ctx->Mesa_DXTn);
}
st_QuerySamplesForFormat(struct gl_context *ctx, GLenum internalFormat,
int samples[16])
{
- struct pipe_screen *screen = st_context(ctx)->pipe->screen;
+ struct st_context *st = st_context(ctx);
enum pipe_format format;
unsigned i, bind, num_sample_counts = 0;
/* Set sample counts in descending order. */
for (i = 16; i > 1; i--) {
- format = st_choose_format(screen, internalFormat, GL_NONE, GL_NONE,
+ format = st_choose_format(st, internalFormat, GL_NONE, GL_NONE,
PIPE_TEXTURE_2D, i, bind, FALSE);
if (format != PIPE_FORMAT_NONE) {
extern enum pipe_format
-st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
+st_choose_format(struct st_context *st, GLenum internalFormat,
GLenum format, GLenum type,
enum pipe_texture_target target, unsigned sample_count,
unsigned bindings, boolean allow_dxt);
extern enum pipe_format
-st_choose_renderbuffer_format(struct pipe_screen *screen,
+st_choose_renderbuffer_format(struct st_context *st,
GLenum internalFormat, unsigned sample_count);
st_create_color_map_texture(struct gl_context *ctx)
{
struct st_context *st = st_context(ctx);
- struct pipe_context *pipe = st->pipe;
struct pipe_resource *pt;
enum pipe_format format;
const uint texSize = 256; /* simple, and usually perfect */
/* find an RGBA texture format */
- format = st_choose_format(pipe->screen, GL_RGBA, GL_NONE, GL_NONE,
+ format = st_choose_format(st, GL_RGBA, GL_NONE, GL_NONE,
PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW,
FALSE);