Move pf_get_block() to u_format auxiliary module.

This commit is contained in:
Michal Krol
2009-12-03 10:52:47 +01:00
parent 0bed834be4
commit 6df42d8023
37 changed files with 99 additions and 79 deletions
@@ -35,6 +35,8 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_shader_tokens.h"
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
@@ -402,7 +404,7 @@ aaline_create_texture(struct aaline_stage *aaline)
texTemp.width0 = 1 << MAX_TEXTURE_LEVEL;
texTemp.height0 = 1 << MAX_TEXTURE_LEVEL;
texTemp.depth0 = 1;
pf_get_block(texTemp.format, &texTemp.block);
util_format_get_block(texTemp.format, &texTemp.block);
aaline->texture = screen->texture_create(screen, &texTemp);
if (!aaline->texture)
@@ -38,6 +38,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_shader_tokens.h"
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
@@ -431,7 +432,7 @@ pstip_create_texture(struct pstip_stage *pstip)
texTemp.width0 = 32;
texTemp.height0 = 32;
texTemp.depth0 = 1;
pf_get_block(texTemp.format, &texTemp.block);
util_format_get_block(texTemp.format, &texTemp.block);
pstip->texture = screen->texture_create(screen, &texTemp);
if (pstip->texture == NULL)
+2 -1
View File
@@ -42,6 +42,7 @@
#include "util/u_blit.h"
#include "util/u_draw_quad.h"
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "util/u_simple_shaders.h"
@@ -357,7 +358,7 @@ util_blit_pixels_writemask(struct blit_state *ctx,
texTemp.width0 = srcW;
texTemp.height0 = srcH;
texTemp.depth0 = 1;
pf_get_block(src->format, &texTemp.block);
util_format_get_block(src->format, &texTemp.block);
tex = screen->texture_create(screen, &texTemp);
if (!tex)
+25 -1
View File
@@ -50,7 +50,7 @@ struct util_format_block
/** Block height in pixels */
unsigned height;
/** Block size in bytes */
/** Block size in bits */
unsigned bits;
};
@@ -159,6 +159,30 @@ util_format_is_depth_and_stencil(enum pipe_format format)
desc->swizzle[1] != UTIL_FORMAT_SWIZZLE_NONE) ? TRUE : FALSE;
}
/**
* Describe pixel format's block.
*
* @sa http://msdn2.microsoft.com/en-us/library/ms796147.aspx
*/
static INLINE void
util_format_get_block(enum pipe_format format,
struct pipe_format_block *block)
{
const struct util_format_description *desc = util_format_description(format);
assert(format);
if (!format) {
block->size = 0;
block->width = 1;
block->height = 1;
return;
}
block->size = desc->block.bits / 8;
block->width = desc->block.width;
block->height = desc->block.height;
}
/*
* Format access functions.
+2 -1
View File
@@ -36,6 +36,7 @@
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "util/u_format.h"
#include "util/u_surface.h"
@@ -82,7 +83,7 @@ util_create_rgba_surface(struct pipe_screen *screen,
templ.width0 = width;
templ.height0 = height;
templ.depth0 = 1;
pf_get_block(format, &templ.block);
util_format_get_block(format, &templ.block);
templ.tex_usage = usage;
*textureOut = screen->texture_create(screen, &templ);
@@ -29,6 +29,7 @@
#include <assert.h>
#include <pipe/p_context.h>
#include <pipe/p_inlines.h>
#include <util/u_format.h>
#include <util/u_math.h>
#include <util/u_memory.h>
#include <tgsi/tgsi_parse.h>
@@ -834,7 +835,7 @@ init_buffers(struct vl_mpeg12_mc_renderer *r)
template.height0 = r->pot_buffers ?
util_next_power_of_two(r->picture_height) : r->picture_height;
template.depth0 = 1;
pf_get_block(template.format, &template.block);
util_format_get_block(template.format, &template.block);
template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER | PIPE_TEXTURE_USAGE_DYNAMIC;
r->textures.individual.y = r->pipe->screen->texture_create(r->pipe->screen, &template);
+4 -2
View File
@@ -34,6 +34,8 @@
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
@@ -63,7 +65,7 @@ llvmpipe_texture_layout(struct llvmpipe_screen *screen,
unsigned buffer_size = 0;
pf_get_block(lpt->base.format, &lpt->base.block);
util_format_get_block(lpt->base.format, &lpt->base.block);
for (level = 0; level <= pt->last_level; level++) {
unsigned nblocksx, nblocksy;
@@ -100,7 +102,7 @@ llvmpipe_displaytarget_layout(struct llvmpipe_screen *screen,
{
struct llvmpipe_winsys *winsys = screen->winsys;
pf_get_block(lpt->base.format, &lpt->base.block);
util_format_get_block(lpt->base.format, &lpt->base.block);
lpt->base.nblocksx[0] = pf_get_nblocksx(&lpt->base.block, lpt->base.width0);
lpt->base.nblocksy[0] = pf_get_nblocksy(&lpt->base.block, lpt->base.height0);
+2 -1
View File
@@ -22,6 +22,7 @@
#include "pipe/p_screen.h"
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
@@ -283,7 +284,7 @@ r300_video_surface_create(struct pipe_screen *screen,
template.width0 = util_next_power_of_two(width);
template.height0 = util_next_power_of_two(height);
template.depth0 = 1;
pf_get_block(template.format, &template.block);
util_format_get_block(template.format, &template.block);
template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER |
PIPE_TEXTURE_USAGE_RENDER_TARGET;
+3 -1
View File
@@ -32,6 +32,8 @@
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
@@ -438,7 +440,7 @@ softpipe_video_surface_create(struct pipe_screen *screen,
template.width0 = util_next_power_of_two(width);
template.height0 = util_next_power_of_two(height);
template.depth0 = 1;
pf_get_block(template.format, &template.block);
util_format_get_block(template.format, &template.block);
template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER | PIPE_TEXTURE_USAGE_RENDER_TARGET;
sp_vsfc->tex = screen->texture_create(screen, &template);
-39
View File
@@ -479,45 +479,6 @@ struct pipe_format_block
unsigned height;
};
/**
* Describe pixel format's block.
*
* @sa http://msdn2.microsoft.com/en-us/library/ms796147.aspx
*/
static INLINE void
pf_get_block(enum pipe_format format, struct pipe_format_block *block)
{
switch(format) {
case PIPE_FORMAT_DXT1_RGBA:
case PIPE_FORMAT_DXT1_RGB:
case PIPE_FORMAT_DXT1_SRGBA:
case PIPE_FORMAT_DXT1_SRGB:
block->size = 8;
block->width = 4;
block->height = 4;
break;
case PIPE_FORMAT_DXT3_RGBA:
case PIPE_FORMAT_DXT5_RGBA:
case PIPE_FORMAT_DXT3_SRGBA:
case PIPE_FORMAT_DXT5_SRGBA:
block->size = 16;
block->width = 4;
block->height = 4;
break;
case PIPE_FORMAT_YCBCR:
case PIPE_FORMAT_YCBCR_REV:
block->size = 4; /* 2*cpp */
block->width = 2;
block->height = 1;
break;
default:
block->size = pf_get_size(format);
block->width = 1;
block->height = 1;
break;
}
}
static INLINE unsigned
pf_get_nblocksx(const struct pipe_format_block *block, unsigned x)
{
@@ -44,6 +44,7 @@
#include "state_tracker/st_context.h"
#include "state_tracker/st_cb_fbo.h"
#include "util/u_format.h"
#include "util/u_memory.h"
#include "util/u_rect.h"
@@ -66,7 +67,7 @@ dri_surface_from_handle(struct drm_api *api,
templat.format = format;
templat.width0 = width;
templat.height0 = height;
pf_get_block(templat.format, &templat.block);
util_format_get_block(templat.format, &templat.block);
texture = api->texture_from_shared_handle(api, screen, &templat,
"dri2 buffer", pitch, handle);
+2 -1
View File
@@ -12,6 +12,7 @@
#include "state_tracker/drm_api.h"
#include "util/u_format.h"
#include "util/u_rect.h"
/*
@@ -118,7 +119,7 @@ drm_create_texture(_EGLDisplay *dpy,
templat.format = PIPE_FORMAT_A8R8G8B8_UNORM;
templat.width0 = w;
templat.height0 = h;
pf_get_block(templat.format, &templat.block);
util_format_get_block(templat.format, &templat.block);
texture = screen->texture_create(dev->screen,
&templat);
+1 -1
View File
@@ -112,7 +112,7 @@ struct st_device {
struct pipe_texture templat;
memset(&templat, 0, sizeof(templat));
templat.format = format;
pf_get_block(templat.format, &templat.block);
util_format_get_block(templat.format, &templat.block);
templat.width0 = width;
templat.height0 = height;
templat.depth0 = depth;
@@ -40,6 +40,7 @@
#include "pipe/p_format.h"
#include "pipe/p_context.h"
#include "pipe/p_inlines.h"
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "softpipe/sp_winsys.h"
@@ -179,7 +180,7 @@ st_softpipe_surface_buffer_create(struct pipe_winsys *winsys,
struct pipe_format_block block;
unsigned nblocksx, nblocksy;
pf_get_block(format, &block);
util_format_get_block(format, &block);
nblocksx = pf_get_nblocksx(&block, width);
nblocksy = pf_get_nblocksy(&block, height);
*stride = round_up(nblocksx * block.size, alignment);
@@ -38,6 +38,7 @@
#include "pipe/p_screen.h"
#include "pipe/p_shader_tokens.h"
#include "util/u_format.h"
#include "util/u_memory.h"
@@ -71,7 +72,7 @@ static INLINE struct pipe_texture *create_texture_1d(struct vg_context *ctx,
templ.width0 = color_data_len;
templ.height0 = 1;
templ.depth0 = 1;
pf_get_block(PIPE_FORMAT_A8R8G8B8_UNORM, &templ.block);
util_format_get_block(PIPE_FORMAT_A8R8G8B8_UNORM, &templ.block);
templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
tex = screen->texture_create(screen, &templ);
+2 -1
View File
@@ -39,6 +39,7 @@
#include "pipe/p_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_blit.h"
#include "util/u_format.h"
#include "util/u_tile.h"
#include "util/u_memory.h"
#include "util/u_math.h"
@@ -270,7 +271,7 @@ struct vg_image * image_create(VGImageFormat format,
memset(&pt, 0, sizeof(pt));
pt.target = PIPE_TEXTURE_2D;
pt.format = pformat;
pf_get_block(pformat, &pt.block);
util_format_get_block(pformat, &pt.block);
pt.last_level = 0;
pt.width0 = width;
pt.height0 = height;
+2 -1
View File
@@ -36,6 +36,7 @@
#include "pipe/p_context.h"
#include "pipe/p_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_format.h"
#include "util/u_memory.h"
struct vg_mask_layer {
@@ -491,7 +492,7 @@ struct vg_mask_layer * mask_layer_create(VGint width, VGint height)
memset(&pt, 0, sizeof(pt));
pt.target = PIPE_TEXTURE_2D;
pt.format = PIPE_FORMAT_A8R8G8B8_UNORM;
pf_get_block(PIPE_FORMAT_A8R8G8B8_UNORM, &pt.block);
util_format_get_block(PIPE_FORMAT_A8R8G8B8_UNORM, &pt.block);
pt.last_level = 0;
pt.width0 = width;
pt.height0 = height;
+2 -1
View File
@@ -34,6 +34,7 @@
#include "pipe/p_compiler.h"
#include "pipe/p_inlines.h"
#include "util/u_format.h"
#include "util/u_memory.h"
#include "util/u_math.h"
@@ -154,7 +155,7 @@ static INLINE struct pipe_texture *create_gradient_texture(struct vg_paint *p)
templ.width0 = 1024;
templ.height0 = 1;
templ.depth0 = 1;
pf_get_block(PIPE_FORMAT_A8R8G8B8_UNORM, &templ.block);
util_format_get_block(PIPE_FORMAT_A8R8G8B8_UNORM, &templ.block);
templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
tex = screen->texture_create(screen, &templ);
+2 -1
View File
@@ -35,6 +35,7 @@
#include "pipe/p_shader_tokens.h"
#include "util/u_draw_quad.h"
#include "util/u_format.h"
#include "util/u_simple_shaders.h"
#include "util/u_memory.h"
#include "util/u_rect.h"
@@ -448,7 +449,7 @@ void renderer_copy_surface(struct renderer *ctx,
texTemp.width0 = srcW;
texTemp.height0 = srcH;
texTemp.depth0 = 1;
pf_get_block(src->format, &texTemp.block);
util_format_get_block(src->format, &texTemp.block);
tex = screen->texture_create(screen, &texTemp);
if (!tex)
+2 -1
View File
@@ -31,6 +31,7 @@
#include "pipe/p_context.h"
#include "pipe/p_inlines.h"
#include "pipe/p_screen.h"
#include "util/u_format.h"
#include "util/u_memory.h"
#include "util/u_math.h"
@@ -50,7 +51,7 @@ create_texture(struct pipe_context *pipe, enum pipe_format format,
}
templ.target = PIPE_TEXTURE_2D;
pf_get_block(templ.format, &templ.block);
util_format_get_block(templ.format, &templ.block);
templ.width0 = width;
templ.height0 = height;
templ.depth0 = 1;
+2 -1
View File
@@ -50,6 +50,7 @@
#endif
#include "pipe/p_inlines.h"
#include "util/u_format.h"
#include "util/u_rect.h"
#ifdef HAVE_LIBKMS
@@ -200,7 +201,7 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 * image)
templat.format = PIPE_FORMAT_A8R8G8B8_UNORM;
templat.width0 = 64;
templat.height0 = 64;
pf_get_block(templat.format, &templat.block);
util_format_get_block(templat.format, &templat.block);
crtcp->cursor_tex = ms->screen->texture_create(ms->screen,
&templat);
+1 -1
View File
@@ -109,7 +109,7 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int form
else
template.format = ms->ds_depth_bits_last ?
PIPE_FORMAT_S8Z24_UNORM : PIPE_FORMAT_Z24S8_UNORM;
pf_get_block(template.format, &template.block);
util_format_get_block(template.format, &template.block);
template.width0 = pDraw->width;
template.height0 = pDraw->height;
template.depth0 = 1;
+3 -2
View File
@@ -43,6 +43,7 @@
#include "pipe/p_state.h"
#include "pipe/p_inlines.h"
#include "util/u_format.h"
#include "util/u_rect.h"
#include "util/u_math.h"
#include "util/u_debug.h"
@@ -899,7 +900,7 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
memset(&template, 0, sizeof(template));
template.target = PIPE_TEXTURE_2D;
exa_get_pipe_format(depth, &template.format, &bitsPerPixel, &priv->picture_format);
pf_get_block(template.format, &template.block);
util_format_get_block(template.format, &template.block);
if (ROUND_UP_TEXTURES && priv->flags == 0) {
template.width0 = util_next_power_of_two(width);
template.height0 = util_next_power_of_two(height);
@@ -985,7 +986,7 @@ xorg_exa_create_root_texture(ScrnInfoPtr pScrn,
memset(&template, 0, sizeof(template));
template.target = PIPE_TEXTURE_2D;
exa_get_pipe_format(depth, &template.format, &bitsPerPixel, &dummy);
pf_get_block(template.format, &template.block);
util_format_get_block(template.format, &template.block);
template.width0 = width;
template.height0 = height;
template.depth0 = 1;
@@ -5,6 +5,7 @@
#include "cso_cache/cso_context.h"
#include "util/u_draw_quad.h"
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "util/u_rect.h"
@@ -512,7 +513,7 @@ renderer_clone_texture(struct xorg_renderer *r,
templ.width0 = src->width0;
templ.height0 = src->height0;
templ.depth0 = 1;
pf_get_block(format, &templ.block);
util_format_get_block(format, &templ.block);
templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
pt = screen->texture_create(screen, &templ);
+3 -1
View File
@@ -13,6 +13,8 @@
#include "pipe/p_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_format.h"
/*XXX get these from pipe's texture limits */
#define IMAGE_MAX_WIDTH 2048
#define IMAGE_MAX_HEIGHT 2048
@@ -170,7 +172,7 @@ create_component_texture(struct pipe_context *pipe,
templ.width0 = width;
templ.height0 = height;
templ.depth0 = 1;
pf_get_block(PIPE_FORMAT_L8_UNORM, &templ.block);
util_format_get_block(PIPE_FORMAT_L8_UNORM, &templ.block);
templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
tex = screen->texture_create(screen, &templ);
@@ -106,7 +106,7 @@ CreateOrResizeBackBuffer(struct pipe_video_context *vpipe, unsigned int width, u
template.width0 = width;
template.height0 = height;
template.depth0 = 1;
pf_get_block(template.format, &template.block);
util_format_get_block(template.format, &template.block);
template.tex_usage = PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
tex = vpipe->screen->texture_create(vpipe->screen, &template);
@@ -1,5 +1,6 @@
#include "pipe/p_context.h"
#include "pipe/p_state.h"
#include "util/u_format.h"
#include "util/u_memory.h"
#include "nouveau_drm_api.h"
@@ -28,7 +29,7 @@ dri_surface_from_handle(struct drm_api *api, struct pipe_screen *pscreen,
tmpl.format = format;
tmpl.width0 = width;
tmpl.height0 = height;
pf_get_block(tmpl.format, &tmpl.block);
util_format_get_block(tmpl.format, &tmpl.block);
pt = api->texture_from_shared_handle(api, pscreen, &tmpl,
"front buffer", pitch, handle);
@@ -36,6 +36,8 @@
#include "softpipe/sp_texture.h"
#include "r300_context.h"
#include <X11/Xutil.h>
#include "util/u_format.h"
struct radeon_vl_context
{
Display *display;
@@ -116,7 +118,7 @@ static struct pipe_buffer *radeon_surface_buffer_create(struct pipe_winsys *ws,
struct pipe_format_block block;
unsigned nblocksx, nblocksy, size;
pf_get_block(format, &block);
util_format_get_block(format, &block);
nblocksx = pf_get_nblocksx(&block, width);
nblocksy = pf_get_nblocksy(&block, height);
@@ -321,7 +323,7 @@ struct pipe_surface *radeon_surface_from_handle(struct radeon_context *radeon_co
tmpl.height0 = h;
tmpl.depth0 = 1;
tmpl.format = format;
pf_get_block(tmpl.format, &tmpl.block);
util_format_get_block(tmpl.format, &tmpl.block);
tmpl.nblocksx[0] = pf_get_nblocksx(&tmpl.block, w);
tmpl.nblocksy[0] = pf_get_nblocksy(&tmpl.block, h);
+2 -1
View File
@@ -38,6 +38,7 @@
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_state.h"
#include "pipe/p_inlines.h"
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
@@ -173,7 +174,7 @@ surface_buffer_create(struct pipe_winsys *winsys,
struct pipe_format_block block;
unsigned nblocksx, nblocksy;
pf_get_block(format, &block);
util_format_get_block(format, &block);
nblocksx = pf_get_nblocksx(&block, width);
nblocksy = pf_get_nblocksy(&block, height);
*stride = round_up(nblocksx * block.size, alignment);
+2 -1
View File
@@ -30,6 +30,7 @@
#include <pipe/internal/p_winsys_screen.h>
#include <pipe/p_state.h>
#include <pipe/p_inlines.h>
#include <util/u_format.h>
#include <util/u_memory.h>
#include <util/u_math.h>
#include <softpipe/sp_winsys.h>
@@ -141,7 +142,7 @@ static struct pipe_buffer* xsp_surface_buffer_create
struct pipe_format_block block;
unsigned nblocksx, nblocksy;
pf_get_block(format, &block);
util_format_get_block(format, &block);
nblocksx = pf_get_nblocksx(&block, width);
nblocksy = pf_get_nblocksy(&block, height);
*stride = align(nblocksx * block.size, ALIGNMENT);
+2 -1
View File
@@ -42,6 +42,7 @@
#include "pipe/p_format.h"
#include "pipe/p_context.h"
#include "pipe/p_inlines.h"
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "softpipe/sp_winsys.h"
@@ -173,7 +174,7 @@ gdi_softpipe_surface_buffer_create(struct pipe_winsys *winsys,
struct pipe_format_block block;
unsigned nblocksx, nblocksy;
pf_get_block(format, &block);
util_format_get_block(format, &block);
nblocksx = pf_get_nblocksx(&block, width);
nblocksy = pf_get_nblocksy(&block, height);
*stride = round_up(nblocksx * block.size, alignment);
+2 -1
View File
@@ -45,6 +45,7 @@
#include "pipe/p_format.h"
#include "pipe/p_context.h"
#include "pipe/p_inlines.h"
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
@@ -297,7 +298,7 @@ xm_surface_buffer_create(struct pipe_winsys *winsys,
struct pipe_format_block block;
unsigned nblocksx, nblocksy;
pf_get_block(format, &block);
util_format_get_block(format, &block);
nblocksx = pf_get_nblocksx(&block, width);
nblocksy = pf_get_nblocksy(&block, height);
*stride = round_up(nblocksx * block.size, alignment);
+2 -1
View File
@@ -44,6 +44,7 @@
#include "pipe/p_format.h"
#include "pipe/p_context.h"
#include "pipe/p_inlines.h"
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "llvmpipe/lp_winsys.h"
@@ -331,7 +332,7 @@ xm_displaytarget_create(struct llvmpipe_winsys *winsys,
xm_dt->width = width;
xm_dt->height = height;
pf_get_block(format, &xm_dt->block);
util_format_get_block(format, &xm_dt->block);
nblocksx = pf_get_nblocksx(&xm_dt->block, width);
nblocksy = pf_get_nblocksy(&xm_dt->block, height);
xm_dt->stride = align(nblocksx * xm_dt->block.size, alignment);
+2 -1
View File
@@ -42,6 +42,7 @@
#include "pipe/p_format.h"
#include "pipe/p_context.h"
#include "pipe/p_inlines.h"
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "softpipe/sp_winsys.h"
@@ -363,7 +364,7 @@ xm_surface_buffer_create(struct pipe_winsys *winsys,
struct pipe_format_block block;
unsigned nblocksx, nblocksy, size;
pf_get_block(format, &block);
util_format_get_block(format, &block);
nblocksx = pf_get_nblocksx(&block, width);
nblocksy = pf_get_nblocksy(&block, height);
*stride = align(nblocksx * block.size, alignment);
+2 -2
View File
@@ -105,7 +105,7 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
_mesa_free(strb->data);
assert(strb->format != PIPE_FORMAT_NONE);
pf_get_block(strb->format, &block);
util_format_get_block(strb->format, &block);
strb->stride = pf_get_stride(&block, width);
size = pf_get_2d_size(&block, strb->stride, height);
@@ -128,7 +128,7 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
memset(&template, 0, sizeof(template));
template.target = PIPE_TEXTURE_2D;
template.format = format;
pf_get_block(format, &template.block);
util_format_get_block(format, &template.block);
template.width0 = width;
template.height0 = height;
template.depth0 = 1;
+1 -1
View File
@@ -406,7 +406,7 @@ compress_with_blit(GLcontext * ctx,
memset(&templ, 0, sizeof(templ));
templ.target = PIPE_TEXTURE_2D;
templ.format = st_mesa_format_to_pipe_format(mesa_format);
pf_get_block(templ.format, &templ.block);
util_format_get_block(templ.format, &templ.block);
templ.width0 = width;
templ.height0 = height;
templ.depth0 = 1;
+2 -1
View File
@@ -43,6 +43,7 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "util/u_format.h"
#include "util/u_rect.h"
#include "util/u_math.h"
@@ -104,7 +105,7 @@ st_texture_create(struct st_context *st,
pt.width0 = width0;
pt.height0 = height0;
pt.depth0 = depth0;
pf_get_block(format, &pt.block);
util_format_get_block(format, &pt.block);
pt.tex_usage = usage;
newtex = screen->texture_create(screen, &pt);