st: remove comp_byte parameter to st_texture_create()
We can determine if the texture is compressed by checking the format.
This commit is contained in:
@@ -125,8 +125,7 @@ create_color_map_texture(GLcontext *ctx)
|
|||||||
|
|
||||||
/* create texture for color map/table */
|
/* create texture for color map/table */
|
||||||
pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, format, 0,
|
pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, format, 0,
|
||||||
texSize, texSize, 1, 0,
|
texSize, texSize, 1, PIPE_TEXTURE_USAGE_SAMPLER);
|
||||||
PIPE_TEXTURE_USAGE_SAMPLER);
|
|
||||||
return pt;
|
return pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -330,7 +330,7 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
|
|||||||
* Create texture to hold bitmap pattern.
|
* Create texture to hold bitmap pattern.
|
||||||
*/
|
*/
|
||||||
pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, ctx->st->bitmap.tex_format,
|
pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, ctx->st->bitmap.tex_format,
|
||||||
0, width, height, 1, 0,
|
0, width, height, 1,
|
||||||
PIPE_TEXTURE_USAGE_SAMPLER);
|
PIPE_TEXTURE_USAGE_SAMPLER);
|
||||||
if (!pt) {
|
if (!pt) {
|
||||||
_mesa_unmap_bitmap_pbo(ctx, unpack);
|
_mesa_unmap_bitmap_pbo(ctx, unpack);
|
||||||
@@ -579,8 +579,7 @@ reset_cache(struct st_context *st)
|
|||||||
cache->texture = st_texture_create(st, PIPE_TEXTURE_2D,
|
cache->texture = st_texture_create(st, PIPE_TEXTURE_2D,
|
||||||
st->bitmap.tex_format, 0,
|
st->bitmap.tex_format, 0,
|
||||||
BITMAP_CACHE_WIDTH, BITMAP_CACHE_HEIGHT,
|
BITMAP_CACHE_WIDTH, BITMAP_CACHE_HEIGHT,
|
||||||
1, 0,
|
1, PIPE_TEXTURE_USAGE_SAMPLER);
|
||||||
PIPE_TEXTURE_USAGE_SAMPLER);
|
|
||||||
|
|
||||||
/* Map the texture transfer.
|
/* Map the texture transfer.
|
||||||
* Subsequent glBitmap calls will write into the texture image.
|
* Subsequent glBitmap calls will write into the texture image.
|
||||||
|
@@ -351,8 +351,7 @@ make_texture(struct st_context *st,
|
|||||||
if (!pixels)
|
if (!pixels)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
pt = st_texture_create(st, PIPE_TEXTURE_2D, pipeFormat, 0, width, height,
|
pt = st_texture_create(st, PIPE_TEXTURE_2D, pipeFormat, 0, width, height, 1,
|
||||||
1, 0,
|
|
||||||
PIPE_TEXTURE_USAGE_SAMPLER);
|
PIPE_TEXTURE_USAGE_SAMPLER);
|
||||||
if (!pt) {
|
if (!pt) {
|
||||||
_mesa_unmap_drawpix_pbo(ctx, unpack);
|
_mesa_unmap_drawpix_pbo(ctx, unpack);
|
||||||
@@ -951,7 +950,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, texFormat, 0,
|
pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, texFormat, 0,
|
||||||
width, height, 1, 0,
|
width, height, 1,
|
||||||
PIPE_TEXTURE_USAGE_SAMPLER);
|
PIPE_TEXTURE_USAGE_SAMPLER);
|
||||||
if (!pt)
|
if (!pt)
|
||||||
return;
|
return;
|
||||||
|
@@ -265,7 +265,7 @@ guess_and_alloc_texture(struct st_context *st,
|
|||||||
GLuint width = stImage->base.Width2; /* size w/out border */
|
GLuint width = stImage->base.Width2; /* size w/out border */
|
||||||
GLuint height = stImage->base.Height2;
|
GLuint height = stImage->base.Height2;
|
||||||
GLuint depth = stImage->base.Depth2;
|
GLuint depth = stImage->base.Depth2;
|
||||||
GLuint i, comp_byte = 0, usage;
|
GLuint i, usage;
|
||||||
enum pipe_format fmt;
|
enum pipe_format fmt;
|
||||||
|
|
||||||
DBG("%s\n", __FUNCTION__);
|
DBG("%s\n", __FUNCTION__);
|
||||||
@@ -323,9 +323,6 @@ guess_and_alloc_texture(struct st_context *st,
|
|||||||
lastLevel = firstLevel + MAX2(MAX2(l2width, l2height), l2depth);
|
lastLevel = firstLevel + MAX2(MAX2(l2width, l2height), l2depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stImage->base.IsCompressed)
|
|
||||||
comp_byte = compressed_num_bytes(stImage->base.TexFormat->MesaFormat);
|
|
||||||
|
|
||||||
fmt = st_mesa_format_to_pipe_format(stImage->base.TexFormat->MesaFormat);
|
fmt = st_mesa_format_to_pipe_format(stImage->base.TexFormat->MesaFormat);
|
||||||
|
|
||||||
usage = default_usage(fmt);
|
usage = default_usage(fmt);
|
||||||
@@ -337,7 +334,6 @@ guess_and_alloc_texture(struct st_context *st,
|
|||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
depth,
|
depth,
|
||||||
comp_byte,
|
|
||||||
usage);
|
usage);
|
||||||
|
|
||||||
DBG("%s - success\n", __FUNCTION__);
|
DBG("%s - success\n", __FUNCTION__);
|
||||||
@@ -1353,7 +1349,7 @@ st_finalize_texture(GLcontext *ctx,
|
|||||||
{
|
{
|
||||||
struct st_texture_object *stObj = st_texture_object(tObj);
|
struct st_texture_object *stObj = st_texture_object(tObj);
|
||||||
const GLuint nr_faces = (stObj->base.Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
|
const GLuint nr_faces = (stObj->base.Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
|
||||||
GLuint comp_byte = 0, cpp, face;
|
GLuint cpp, face;
|
||||||
struct st_texture_image *firstImage;
|
struct st_texture_image *firstImage;
|
||||||
|
|
||||||
*needFlush = GL_FALSE;
|
*needFlush = GL_FALSE;
|
||||||
@@ -1380,8 +1376,7 @@ st_finalize_texture(GLcontext *ctx,
|
|||||||
|
|
||||||
/* FIXME: determine format block instead of cpp */
|
/* FIXME: determine format block instead of cpp */
|
||||||
if (firstImage->base.IsCompressed) {
|
if (firstImage->base.IsCompressed) {
|
||||||
comp_byte = compressed_num_bytes(firstImage->base.TexFormat->MesaFormat);
|
cpp = compressed_num_bytes(firstImage->base.TexFormat->MesaFormat);
|
||||||
cpp = comp_byte;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cpp = firstImage->base.TexFormat->TexelBytes;
|
cpp = firstImage->base.TexFormat->TexelBytes;
|
||||||
@@ -1420,7 +1415,6 @@ st_finalize_texture(GLcontext *ctx,
|
|||||||
firstImage->base.Width2,
|
firstImage->base.Width2,
|
||||||
firstImage->base.Height2,
|
firstImage->base.Height2,
|
||||||
firstImage->base.Depth2,
|
firstImage->base.Depth2,
|
||||||
comp_byte,
|
|
||||||
usage);
|
usage);
|
||||||
|
|
||||||
if (!stObj->pt) {
|
if (!stObj->pt) {
|
||||||
|
@@ -78,7 +78,6 @@ st_texture_create(struct st_context *st,
|
|||||||
GLuint width0,
|
GLuint width0,
|
||||||
GLuint height0,
|
GLuint height0,
|
||||||
GLuint depth0,
|
GLuint depth0,
|
||||||
GLuint compress_byte,
|
|
||||||
GLuint usage )
|
GLuint usage )
|
||||||
{
|
{
|
||||||
struct pipe_texture pt, *newtex;
|
struct pipe_texture pt, *newtex;
|
||||||
@@ -101,7 +100,7 @@ st_texture_create(struct st_context *st,
|
|||||||
pt.width[0] = width0;
|
pt.width[0] = width0;
|
||||||
pt.height[0] = height0;
|
pt.height[0] = height0;
|
||||||
pt.depth[0] = depth0;
|
pt.depth[0] = depth0;
|
||||||
pt.compressed = compress_byte ? 1 : 0;
|
pt.compressed = pf_is_compressed(format);
|
||||||
pf_get_block(format, &pt.block);
|
pf_get_block(format, &pt.block);
|
||||||
pt.tex_usage = usage;
|
pt.tex_usage = usage;
|
||||||
|
|
||||||
|
@@ -108,7 +108,6 @@ st_texture_create(struct st_context *st,
|
|||||||
GLuint width0,
|
GLuint width0,
|
||||||
GLuint height0,
|
GLuint height0,
|
||||||
GLuint depth0,
|
GLuint depth0,
|
||||||
GLuint compress_byte,
|
|
||||||
GLuint tex_usage );
|
GLuint tex_usage );
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user