mesa/st: move pixel/bitmap functions to direct call
Acked-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14100>
This commit is contained in:
parent
4e13c7d46a
commit
37fb8058fb
|
@ -134,59 +134,6 @@ struct dd_function_table {
|
|||
*/
|
||||
void (*Flush)(struct gl_context *ctx, unsigned gallium_flush_flags);
|
||||
|
||||
/**
|
||||
* Execute glRasterPos, updating the ctx->Current.Raster fields
|
||||
*/
|
||||
void (*RasterPos)( struct gl_context *ctx, const GLfloat v[4] );
|
||||
|
||||
/**
|
||||
* \name Image-related functions
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
* Called by glDrawPixels().
|
||||
* \p unpack describes how to unpack the source image data.
|
||||
*/
|
||||
void (*DrawPixels)( struct gl_context *ctx,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type,
|
||||
const struct gl_pixelstore_attrib *unpack,
|
||||
const GLvoid *pixels );
|
||||
|
||||
/**
|
||||
* Called by glReadPixels().
|
||||
*/
|
||||
void (*ReadPixels)( struct gl_context *ctx,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type,
|
||||
const struct gl_pixelstore_attrib *unpack,
|
||||
GLvoid *dest );
|
||||
|
||||
/**
|
||||
* Called by glCopyPixels().
|
||||
*/
|
||||
void (*CopyPixels)( struct gl_context *ctx, GLint srcx, GLint srcy,
|
||||
GLsizei width, GLsizei height,
|
||||
GLint dstx, GLint dsty, GLenum type );
|
||||
|
||||
/**
|
||||
* Called by glBitmap().
|
||||
*/
|
||||
void (*Bitmap)( struct gl_context *ctx,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
const struct gl_pixelstore_attrib *unpack,
|
||||
const GLubyte *bitmap );
|
||||
|
||||
/**
|
||||
* Called by display list code for optimized glCallLists/glBitmap rendering
|
||||
* The driver must support texture rectangles of width 1024 or more.
|
||||
*/
|
||||
void (*DrawAtlasBitmaps)(struct gl_context *ctx,
|
||||
const struct gl_bitmap_atlas *atlas,
|
||||
GLuint count, const GLubyte *ids);
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* Called by glCopyImageSubData().
|
||||
*
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "texobj.h"
|
||||
|
||||
#include "state_tracker/st_cb_texture.h"
|
||||
#include "state_tracker/st_cb_readpixels.h"
|
||||
|
||||
static const char *
|
||||
tex_target_name(GLenum tgt)
|
||||
|
@ -326,8 +327,8 @@ _mesa_write_renderbuffer_image(const struct gl_renderbuffer *rb)
|
|||
|
||||
buffer = malloc(rb->Width * rb->Height * 4);
|
||||
|
||||
ctx->Driver.ReadPixels(ctx, 0, 0, rb->Width, rb->Height,
|
||||
format, type, &ctx->DefaultPacking, buffer);
|
||||
st_ReadPixels(ctx, 0, 0, rb->Width, rb->Height,
|
||||
format, type, &ctx->DefaultPacking, buffer);
|
||||
|
||||
/* make filename */
|
||||
snprintf(s, sizeof(s), "/tmp/renderbuffer%u.ppm", rb->Name);
|
||||
|
|
|
@ -77,6 +77,7 @@
|
|||
#include "util/u_memory.h"
|
||||
|
||||
#include "state_tracker/st_cb_texture.h"
|
||||
#include "state_tracker/st_cb_bitmap.h"
|
||||
|
||||
#define USE_BITMAP_ATLAS 1
|
||||
|
||||
|
@ -13466,8 +13467,7 @@ _mesa_GenLists(GLsizei range)
|
|||
}
|
||||
|
||||
if (USE_BITMAP_ATLAS &&
|
||||
range > 16 &&
|
||||
ctx->Driver.DrawAtlasBitmaps) {
|
||||
range > 16) {
|
||||
/* "range > 16" is a rough heuristic to guess when glGenLists might be
|
||||
* used to allocate display lists for glXUseXFont or wglUseFontBitmaps.
|
||||
* Create the empty atlas now.
|
||||
|
@ -13813,8 +13813,7 @@ render_bitmap_atlas(struct gl_context *ctx, GLsizei n, GLenum type,
|
|||
if (!USE_BITMAP_ATLAS ||
|
||||
!ctx->Current.RasterPosValid ||
|
||||
ctx->List.ListBase == 0 ||
|
||||
type != GL_UNSIGNED_BYTE ||
|
||||
!ctx->Driver.DrawAtlasBitmaps) {
|
||||
type != GL_UNSIGNED_BYTE) {
|
||||
/* unsupported */
|
||||
return false;
|
||||
}
|
||||
|
@ -13851,7 +13850,7 @@ render_bitmap_atlas(struct gl_context *ctx, GLsizei n, GLenum type,
|
|||
}
|
||||
}
|
||||
|
||||
ctx->Driver.DrawAtlasBitmaps(ctx, atlas, n, (const GLubyte *) lists);
|
||||
st_DrawAtlasBitmaps(ctx, atlas, n, (const GLubyte *) lists);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
#include "util/u_math.h"
|
||||
#include "util/rounding.h"
|
||||
|
||||
#include "state_tracker/st_cb_bitmap.h"
|
||||
#include "state_tracker/st_cb_drawpixels.h"
|
||||
|
||||
/*
|
||||
* Execute glDrawPixels
|
||||
|
@ -166,8 +168,8 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
|
|||
}
|
||||
}
|
||||
|
||||
ctx->Driver.DrawPixels(ctx, x, y, width, height, format, type,
|
||||
&ctx->Unpack, pixels);
|
||||
st_DrawPixels(ctx, x, y, width, height, format, type,
|
||||
&ctx->Unpack, pixels);
|
||||
}
|
||||
}
|
||||
else if (ctx->RenderMode == GL_FEEDBACK) {
|
||||
|
@ -288,8 +290,8 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
|
|||
if (width > 0 && height > 0) {
|
||||
GLint destx = lroundf(ctx->Current.RasterPos[0]);
|
||||
GLint desty = lroundf(ctx->Current.RasterPos[1]);
|
||||
ctx->Driver.CopyPixels( ctx, srcx, srcy, width, height, destx, desty,
|
||||
type );
|
||||
st_CopyPixels( ctx, srcx, srcy, width, height, destx, desty,
|
||||
type );
|
||||
}
|
||||
}
|
||||
else if (ctx->RenderMode == GL_FEEDBACK) {
|
||||
|
@ -369,7 +371,7 @@ _mesa_Bitmap( GLsizei width, GLsizei height,
|
|||
}
|
||||
}
|
||||
|
||||
ctx->Driver.Bitmap( ctx, x, y, width, height, &ctx->Unpack, bitmap );
|
||||
st_Bitmap( ctx, x, y, width, height, &ctx->Unpack, bitmap );
|
||||
}
|
||||
}
|
||||
else if (ctx->RenderMode == GL_FEEDBACK) {
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "main/viewport.h"
|
||||
#include "util/bitscan.h"
|
||||
|
||||
|
||||
#include "state_tracker/st_cb_rasterpos.h"
|
||||
|
||||
/**
|
||||
* Clip a point against the view volume.
|
||||
|
@ -388,7 +388,7 @@ compute_texgen(struct gl_context *ctx, const GLfloat vObj[4], const GLfloat vEye
|
|||
|
||||
|
||||
/**
|
||||
* glRasterPos transformation. Typically called via ctx->Driver.RasterPos().
|
||||
* glRasterPos transformation.
|
||||
*
|
||||
* \param vObj vertex position in object space
|
||||
*/
|
||||
|
@ -544,7 +544,7 @@ rasterpos(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
|
|||
if (ctx->NewState)
|
||||
_mesa_update_state( ctx );
|
||||
|
||||
ctx->Driver.RasterPos(ctx, p);
|
||||
st_RasterPos(ctx, p);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "pixeltransfer.h"
|
||||
|
||||
#include "state_tracker/st_cb_fbo.h"
|
||||
#include "state_tracker/st_cb_readpixels.h"
|
||||
|
||||
/**
|
||||
* Return true if the conversion L=R+G+B is needed.
|
||||
|
@ -863,7 +864,7 @@ read_depth_stencil_pixels(struct gl_context *ctx,
|
|||
|
||||
|
||||
/**
|
||||
* Software fallback routine for ctx->Driver.ReadPixels().
|
||||
* Software fallback routine.
|
||||
* By time we get here, all error checking will have been done.
|
||||
*/
|
||||
void
|
||||
|
@ -1173,8 +1174,8 @@ read_pixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format,
|
|||
if (ctx->Pack.BufferObj)
|
||||
ctx->Pack.BufferObj->UsageHistory |= USAGE_PIXEL_PACK_BUFFER;
|
||||
|
||||
ctx->Driver.ReadPixels(ctx, x, y, width, height,
|
||||
format, type, &clippedPacking, pixels);
|
||||
st_ReadPixels(ctx, x, y, width, height,
|
||||
format, type, &clippedPacking, pixels);
|
||||
}
|
||||
|
||||
void GLAPIENTRY
|
||||
|
|
|
@ -593,14 +593,10 @@ init_bitmap_state(struct st_context *st)
|
|||
reset_cache(st);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called via ctx->Driver.Bitmap()
|
||||
*/
|
||||
static void
|
||||
void
|
||||
st_Bitmap(struct gl_context *ctx, GLint x, GLint y,
|
||||
GLsizei width, GLsizei height,
|
||||
const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap )
|
||||
const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap)
|
||||
{
|
||||
struct st_context *st = st_context(ctx);
|
||||
struct pipe_resource *pt;
|
||||
|
@ -644,11 +640,7 @@ st_Bitmap(struct gl_context *ctx, GLint x, GLint y,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called via ctx->Driver.DrawAtlasBitmap()
|
||||
*/
|
||||
static void
|
||||
void
|
||||
st_DrawAtlasBitmaps(struct gl_context *ctx,
|
||||
const struct gl_bitmap_atlas *atlas,
|
||||
GLuint count, const GLubyte *ids)
|
||||
|
@ -781,17 +773,6 @@ out:
|
|||
st->dirty |= ST_NEW_FS_CONSTANTS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Per-context init */
|
||||
void
|
||||
st_init_bitmap_functions(struct dd_function_table *functions)
|
||||
{
|
||||
functions->Bitmap = st_Bitmap;
|
||||
functions->DrawAtlasBitmaps = st_DrawAtlasBitmaps;
|
||||
}
|
||||
|
||||
|
||||
/** Per-context tear-down */
|
||||
void
|
||||
st_destroy_bitmap(struct st_context *st)
|
||||
|
|
|
@ -36,9 +36,9 @@ struct dd_function_table;
|
|||
struct st_context;
|
||||
struct gl_program;
|
||||
struct st_program;
|
||||
|
||||
extern void
|
||||
st_init_bitmap_functions(struct dd_function_table *functions);
|
||||
struct gl_bitmap_atlas;
|
||||
struct gl_context;
|
||||
struct gl_pixelstore_attrib;
|
||||
|
||||
extern void
|
||||
st_destroy_bitmap(struct st_context *st);
|
||||
|
@ -51,4 +51,10 @@ st_get_bitmap_shader(const struct tgsi_token *tokens,
|
|||
unsigned tex_target, unsigned sampler_index,
|
||||
bool use_texcoord, bool swizzle_xxxx);
|
||||
|
||||
void st_Bitmap(struct gl_context *ctx, GLint x, GLint y,
|
||||
GLsizei width, GLsizei height,
|
||||
const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap);
|
||||
void st_DrawAtlasBitmaps(struct gl_context *ctx,
|
||||
const struct gl_bitmap_atlas *atlas,
|
||||
GLuint count, const GLubyte *ids);
|
||||
#endif /* ST_CB_BITMAP_H */
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include "main/macros.h"
|
||||
#include "st_cb_bitmap.h"
|
||||
#include "tgsi/tgsi_transform.h"
|
||||
#include "tgsi/tgsi_scan.h"
|
||||
|
|
|
@ -1272,11 +1272,7 @@ setup_sampler_swizzle(struct pipe_sampler_view *sv, GLenum format, GLenum type)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called via ctx->Driver.DrawPixels()
|
||||
*/
|
||||
static void
|
||||
void
|
||||
st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
|
||||
GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type,
|
||||
|
@ -1675,8 +1671,7 @@ blit_copy_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
|
|||
return GL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
void
|
||||
st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
|
||||
GLsizei width, GLsizei height,
|
||||
GLint dstx, GLint dsty, GLenum type)
|
||||
|
@ -1947,15 +1942,6 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
|
|||
pipe_resource_reference(&pt, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void st_init_drawpixels_functions(struct dd_function_table *functions)
|
||||
{
|
||||
functions->DrawPixels = st_DrawPixels;
|
||||
functions->CopyPixels = st_CopyPixels;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
st_destroy_drawpix(struct st_context *st)
|
||||
{
|
||||
|
|
|
@ -34,8 +34,9 @@
|
|||
|
||||
struct dd_function_table;
|
||||
struct st_context;
|
||||
struct gl_context;
|
||||
struct gl_pixelstore_attrib;
|
||||
|
||||
extern void st_init_drawpixels_functions(struct dd_function_table *functions);
|
||||
|
||||
extern void
|
||||
st_destroy_drawpix(struct st_context *st);
|
||||
|
@ -50,4 +51,12 @@ st_get_drawpix_shader(const struct tgsi_token *tokens, bool use_texcoord,
|
|||
extern void
|
||||
st_make_passthrough_vertex_shader(struct st_context *st);
|
||||
|
||||
void st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
|
||||
GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type,
|
||||
const struct gl_pixelstore_attrib *unpack, const void *pixels);
|
||||
void st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
|
||||
GLsizei width, GLsizei height,
|
||||
GLint dstx, GLint dsty, GLenum type);
|
||||
|
||||
#endif /* ST_CB_DRAWPIXELS_H */
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include "main/macros.h"
|
||||
#include "st_cb_drawpixels.h"
|
||||
#include "tgsi/tgsi_transform.h"
|
||||
#include "tgsi/tgsi_scan.h"
|
||||
|
|
|
@ -216,7 +216,7 @@ new_draw_rastpos_stage(struct gl_context *ctx, struct draw_context *draw)
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
void
|
||||
st_RasterPos(struct gl_context *ctx, const GLfloat v[4])
|
||||
{
|
||||
struct st_context *st = st_context(ctx);
|
||||
|
@ -276,10 +276,3 @@ st_RasterPos(struct gl_context *ctx, const GLfloat v[4])
|
|||
draw_set_rasterize_stage(draw, st->selection_stage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void st_init_rasterpos_functions(struct dd_function_table *functions)
|
||||
{
|
||||
functions->RasterPos = st_RasterPos;
|
||||
}
|
||||
|
|
|
@ -28,10 +28,6 @@
|
|||
#ifndef ST_CB_RASTERPOS_H
|
||||
#define ST_CB_RASTERPOS_H
|
||||
|
||||
|
||||
struct dd_function_table;
|
||||
|
||||
extern void st_init_rasterpos_functions(struct dd_function_table *functions);
|
||||
|
||||
void st_RasterPos(struct gl_context *ctx, const GLfloat v[4]);
|
||||
|
||||
#endif /* ST_CB_RASTERPOS_H */
|
||||
|
|
|
@ -408,7 +408,7 @@ try_cached_readpixels(struct st_context *st, struct st_renderbuffer *strb,
|
|||
* texture layouts during texture uploads/downloads, so the blit
|
||||
* we do here should be free in such cases.
|
||||
*/
|
||||
static void
|
||||
void
|
||||
st_ReadPixels(struct gl_context *ctx, GLint x, GLint y,
|
||||
GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type,
|
||||
|
@ -566,8 +566,3 @@ st_ReadPixels(struct gl_context *ctx, GLint x, GLint y,
|
|||
fallback:
|
||||
_mesa_readpixels(ctx, x, y, width, height, format, type, pack, pixels);
|
||||
}
|
||||
|
||||
void st_init_readpixels_functions(struct dd_function_table *functions)
|
||||
{
|
||||
functions->ReadPixels = st_ReadPixels;
|
||||
}
|
||||
|
|
|
@ -31,10 +31,11 @@
|
|||
|
||||
#include "main/glheader.h"
|
||||
|
||||
struct dd_function_table;
|
||||
|
||||
extern void
|
||||
st_init_readpixels_functions(struct dd_function_table *functions);
|
||||
|
||||
void
|
||||
st_ReadPixels(struct gl_context *ctx, GLint x, GLint y,
|
||||
GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type,
|
||||
const struct gl_pixelstore_attrib *pack,
|
||||
void *pixels);
|
||||
|
||||
#endif /* ST_CB_READPIXELS_H */
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
#include "st_cb_condrender.h"
|
||||
#include "st_cb_copyimage.h"
|
||||
#include "st_cb_drawpixels.h"
|
||||
#include "st_cb_rasterpos.h"
|
||||
#include "st_cb_drawtex.h"
|
||||
#include "st_cb_eglimage.h"
|
||||
#include "st_cb_feedback.h"
|
||||
|
@ -59,7 +58,6 @@
|
|||
#include "st_cb_perfquery.h"
|
||||
#include "st_cb_program.h"
|
||||
#include "st_cb_queryobj.h"
|
||||
#include "st_cb_readpixels.h"
|
||||
#include "st_cb_flush.h"
|
||||
#include "st_cb_viewport.h"
|
||||
#include "st_atom.h"
|
||||
|
@ -930,10 +928,7 @@ st_init_driver_functions(struct pipe_screen *screen,
|
|||
st_init_draw_functions(screen, functions);
|
||||
st_init_blit_functions(functions);
|
||||
st_init_bufferobject_functions(screen, functions);
|
||||
st_init_bitmap_functions(functions);
|
||||
st_init_copy_image_functions(functions);
|
||||
st_init_drawpixels_functions(functions);
|
||||
st_init_rasterpos_functions(functions);
|
||||
|
||||
st_init_drawtex_functions(functions);
|
||||
|
||||
|
@ -941,7 +936,6 @@ st_init_driver_functions(struct pipe_screen *screen,
|
|||
|
||||
st_init_msaa_functions(functions);
|
||||
st_init_program_functions(functions);
|
||||
st_init_readpixels_functions(functions);
|
||||
st_init_flush_functions(screen, functions);
|
||||
st_init_viewport_functions(functions);
|
||||
st_init_compute_functions(functions);
|
||||
|
|
Loading…
Reference in New Issue