mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-02 05:48:07 +02:00
added pipe->max_texture_size() query, use it in st_drawpixels()
This commit is contained in:
parent
47fc2c4349
commit
8fbd81b4ed
4 changed files with 76 additions and 0 deletions
|
|
@ -115,6 +115,35 @@ i915_supported_formats(struct pipe_context *pipe,
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* We might want to return max texture levels instead...
|
||||
*/
|
||||
static void
|
||||
i915_max_texture_size(struct pipe_context *pipe, GLuint textureType,
|
||||
GLuint *maxWidth, GLuint *maxHeight, GLuint *maxDepth)
|
||||
{
|
||||
switch (textureType) {
|
||||
case PIPE_TEXTURE_1D:
|
||||
*maxWidth = 2048;
|
||||
break;
|
||||
case PIPE_TEXTURE_2D:
|
||||
*maxWidth =
|
||||
*maxHeight = 2048;
|
||||
break;
|
||||
case PIPE_TEXTURE_3D:
|
||||
*maxWidth =
|
||||
*maxHeight =
|
||||
*maxDepth = 256;
|
||||
break;
|
||||
case PIPE_TEXTURE_CUBE:
|
||||
*maxWidth =
|
||||
*maxHeight = 2048;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void i915_destroy( struct pipe_context *pipe )
|
||||
{
|
||||
|
|
@ -193,6 +222,7 @@ struct pipe_context *i915_create( struct pipe_winsys *pipe_winsys,
|
|||
|
||||
i915->pipe.destroy = i915_destroy;
|
||||
i915->pipe.supported_formats = i915_supported_formats;
|
||||
i915->pipe.max_texture_size = i915_max_texture_size;
|
||||
i915->pipe.draw_vb = i915_draw_vb;
|
||||
i915->pipe.draw_vertices = i915_draw_vertices;
|
||||
i915->pipe.clear = i915_clear;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,11 @@ struct pipe_context {
|
|||
*/
|
||||
const GLuint *(*supported_formats)(struct pipe_context *pipe,
|
||||
GLuint *numFormats);
|
||||
void (*max_texture_size)(struct pipe_context *pipe,
|
||||
GLuint textureType, /* PIPE_TEXTURE_x */
|
||||
GLuint *maxWidth,
|
||||
GLuint *maxHeight,
|
||||
GLuint *maxDepth);
|
||||
|
||||
/*
|
||||
* Drawing
|
||||
|
|
|
|||
|
|
@ -76,6 +76,33 @@ softpipe_supported_formats(struct pipe_context *pipe, GLuint *numFormats)
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
softpipe_max_texture_size(struct pipe_context *pipe, GLuint textureType,
|
||||
GLuint *maxWidth, GLuint *maxHeight,
|
||||
GLuint *maxDepth)
|
||||
{
|
||||
switch (textureType) {
|
||||
case PIPE_TEXTURE_1D:
|
||||
*maxWidth = 1 << (MAX_TEXTURE_LEVELS - 1);
|
||||
break;
|
||||
case PIPE_TEXTURE_2D:
|
||||
*maxWidth =
|
||||
*maxHeight = 1 << (MAX_TEXTURE_LEVELS - 1);
|
||||
break;
|
||||
case PIPE_TEXTURE_3D:
|
||||
*maxWidth =
|
||||
*maxHeight =
|
||||
*maxDepth = 1 << (MAX_3D_TEXTURE_LEVELS - 1);
|
||||
break;
|
||||
case PIPE_TEXTURE_CUBE:
|
||||
*maxWidth =
|
||||
*maxHeight = MAX_TEXTURE_RECT_SIZE;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void map_surfaces(struct softpipe_context *sp)
|
||||
{
|
||||
|
|
@ -201,8 +228,11 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys,
|
|||
softpipe->pipe.winsys = pipe_winsys;
|
||||
softpipe->pipe.destroy = softpipe_destroy;
|
||||
|
||||
/* queries */
|
||||
softpipe->pipe.supported_formats = softpipe_supported_formats;
|
||||
softpipe->pipe.max_texture_size = softpipe_max_texture_size;
|
||||
|
||||
/* state setters */
|
||||
softpipe->pipe.set_alpha_test_state = softpipe_set_alpha_test_state;
|
||||
softpipe->pipe.set_blend_color = softpipe_set_blend_color;
|
||||
softpipe->pipe.set_blend_state = softpipe_set_blend_state;
|
||||
|
|
@ -225,9 +255,11 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys,
|
|||
softpipe->pipe.reset_occlusion_counter = softpipe_reset_occlusion_counter;
|
||||
softpipe->pipe.get_occlusion_counter = softpipe_get_occlusion_counter;
|
||||
|
||||
/* textures */
|
||||
softpipe->pipe.mipmap_tree_layout = softpipe_mipmap_tree_layout;
|
||||
softpipe->pipe.get_tex_surface = softpipe_get_tex_surface;
|
||||
|
||||
/* setup quad rendering stages */
|
||||
softpipe->quad.polygon_stipple = sp_quad_polygon_stipple_stage(softpipe);
|
||||
softpipe->quad.shade = sp_quad_shade_stage(softpipe);
|
||||
softpipe->quad.alpha_test = sp_quad_alpha_test_stage(softpipe);
|
||||
|
|
|
|||
|
|
@ -250,6 +250,15 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
|
|||
struct pipe_context *pipe = ctx->st->pipe;
|
||||
struct pipe_mipmap_tree *mt;
|
||||
GLfloat x0, y0, x1, y1;
|
||||
GLuint maxWidth, maxHeight;
|
||||
|
||||
/* limit checks */
|
||||
/* XXX if DrawPixels image is larger than max texture size, break
|
||||
* it up into chunks.
|
||||
*/
|
||||
pipe->max_texture_size(pipe, PIPE_TEXTURE_2D, &maxWidth, &maxHeight, NULL);
|
||||
assert(width <= maxWidth);
|
||||
assert(height <= maxHeight);
|
||||
|
||||
/* setup state: just scissor */
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue