template.height[0] = 8 * 4;
template.depth[0] = 1;
template.compressed = 0;
- template.cpp = 2;
+ pf_get_block(template.format, &template.block);
context->states.mc.textures[0] = pipe->screen->texture_create(pipe->screen, &template);
decl.Declaration.Semantic = 1;
decl.Semantic.SemanticName = name;
decl.Semantic.SemanticIndex = index;
- decl.u.DeclarationRange.First = first;
- decl.u.DeclarationRange.Last = last;
+ decl.DeclarationRange.First = first;
+ decl.DeclarationRange.Last = last;
return decl;
}
decl.Declaration.Semantic = 1;
decl.Semantic.SemanticName = name;
decl.Semantic.SemanticIndex = index;
- decl.Declaration.Interpolate = 1;
- decl.Interpolation.Interpolate = interpolation;
- decl.u.DeclarationRange.First = first;
- decl.u.DeclarationRange.Last = last;
+ decl.Declaration.Interpolate = interpolation;;
+ decl.DeclarationRange.First = first;
+ decl.DeclarationRange.Last = last;
return decl;
}
decl.Declaration.Semantic = 1;
decl.Semantic.SemanticName = name;
decl.Semantic.SemanticIndex = index;
- decl.u.DeclarationRange.First = first;
- decl.u.DeclarationRange.Last = last;
+ decl.DeclarationRange.First = first;
+ decl.DeclarationRange.Last = last;
return decl;
}
decl.Declaration.Semantic = 1;
decl.Semantic.SemanticName = name;
decl.Semantic.SemanticIndex = index;
- decl.u.DeclarationRange.First = first;
- decl.u.DeclarationRange.Last = last;
+ decl.DeclarationRange.First = first;
+ decl.DeclarationRange.Last = last;
return decl;
}
decl = tgsi_default_full_declaration();
decl.Declaration.File = TGSI_FILE_SAMPLER;
- decl.u.DeclarationRange.First = first;
- decl.u.DeclarationRange.Last = last;
+ decl.DeclarationRange.First = first;
+ decl.DeclarationRange.Last = last;
return decl;
}
{
struct pipe_surface *tex_surface;
short *texels;
+ unsigned int tex_pitch;
unsigned int tb, sb = 0;
assert(context);
);
texels = pipe_surface_map(tex_surface, PIPE_BUFFER_USAGE_CPU_WRITE);
+ tex_pitch = tex_surface->stride / tex_surface->block.size;
for (tb = 0; tb < 4; ++tb)
{
vlGrabFrameCodedFullBlock
(
blocks + sb * VL_BLOCK_WIDTH * VL_BLOCK_HEIGHT,
- texels + tb * tex_surface->pitch * VL_BLOCK_HEIGHT,
- tex_surface->pitch
+ texels + tb * tex_pitch * VL_BLOCK_HEIGHT,
+ tex_pitch
);
else
vlGrabFrameCodedDiffBlock
(
blocks + sb * VL_BLOCK_WIDTH * VL_BLOCK_HEIGHT,
- texels + tb * tex_surface->pitch * VL_BLOCK_HEIGHT,
- tex_surface->pitch
+ texels + tb * tex_pitch * VL_BLOCK_HEIGHT,
+ tex_pitch
);
else
if (sample_type == VL_FULL_SAMPLE)
vlGrabFieldCodedFullBlock
(
blocks + sb * VL_BLOCK_WIDTH * VL_BLOCK_HEIGHT,
- texels + (tb % 2) * tex_surface->pitch * VL_BLOCK_HEIGHT + (tb / 2) * tex_surface->pitch,
- tex_surface->pitch
+ texels + (tb % 2) * tex_pitch * VL_BLOCK_HEIGHT + (tb / 2) * tex_pitch,
+ tex_pitch
);
else
vlGrabFieldCodedDiffBlock
(
blocks + sb * VL_BLOCK_WIDTH * VL_BLOCK_HEIGHT,
- texels + (tb % 2) * tex_surface->pitch * VL_BLOCK_HEIGHT + (tb / 2) * tex_surface->pitch,
- tex_surface->pitch
+ texels + (tb % 2) * tex_pitch * VL_BLOCK_HEIGHT + (tb / 2) * tex_pitch,
+ tex_pitch
);
++sb;
}
else
- vlGrabNoBlock(texels + tb * tex_surface->pitch * VL_BLOCK_HEIGHT, tex_surface->pitch);
+ vlGrabNoBlock(texels + tb * tex_pitch * VL_BLOCK_HEIGHT, tex_pitch);
}
pipe_surface_unmap(tex_surface);
);
texels = pipe_surface_map(tex_surface, PIPE_BUFFER_USAGE_CPU_WRITE);
+ tex_pitch = tex_surface->stride / tex_surface->block.size;
if ((coded_block_pattern >> (1 - tb)) & 1)
{
(
blocks + sb * VL_BLOCK_WIDTH * VL_BLOCK_HEIGHT,
texels,
- tex_surface->pitch
+ tex_pitch
);
else
vlGrabFrameCodedDiffBlock
(
blocks + sb * VL_BLOCK_WIDTH * VL_BLOCK_HEIGHT,
texels,
- tex_surface->pitch
+ tex_pitch
);
++sb;
}
else
- vlGrabNoBlock(texels, tex_surface->pitch);
+ vlGrabNoBlock(texels, tex_pitch);
pipe_surface_unmap(tex_surface);
}
template.height[0] = sfc->height;
template.depth[0] = 1;
template.compressed = 0;
- template.cpp = 4;
+ pf_get_block(template.format, &template.block);
template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER | PIPE_TEXTURE_USAGE_RENDER_TARGET;
sfc->texture = pipe->screen->texture_create(pipe->screen, &template);
return surface;
}
+/* Borrowed from Mesa's xm_winsys */
+static unsigned int round_up(unsigned n, unsigned multiple)
+{
+ return (n + multiple - 1) & ~(multiple - 1);
+}
+
static int xsp_surface_alloc_storage
(
struct pipe_winsys *pws,
surface->width = width;
surface->height = height;
surface->format = format;
- surface->cpp = pf_get_size(format);
- surface->pitch = width;
+ pf_get_block(format, &surface->block);
+ surface->nblocksx = pf_get_nblocksx(&surface->block, width);
+ surface->nblocksy = pf_get_nblocksy(&surface->block, height);
+ surface->stride = round_up(surface->nblocksx * surface->block.size, ALIGNMENT);
surface->usage = flags;
- surface->buffer = pws->buffer_create(pws, ALIGNMENT, PIPE_BUFFER_USAGE_PIXEL, surface->pitch * surface->cpp * height);
+ /* XXX: Need to consider block dims? See xm_winsys.c */
+ surface->buffer = pws->buffer_create(pws, ALIGNMENT, PIPE_BUFFER_USAGE_PIXEL, surface->stride * height);
return 0;
}
-L${GALLIUMDIR}/auxiliary/cso_cache \
-L${GALLIUMDIR}/auxiliary/util \
-L${GALLIUMDIR}/auxiliary/rtasm
-LIBS += -lg3dvl -lsoftpipe -ldraw -ltgsi -ltranslate -lrtasm -lcso_cache -lutil
+LIBS += -lg3dvl -lsoftpipe -ldraw -ltgsi -ltranslate -lrtasm -lcso_cache -lutil -lm
#############################################