summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/g3dvl
diff options
context:
space:
mode:
authorYounes Manton <younes.m@gmail.com>2008-06-30 19:26:22 -0400
committerYounes Manton <younes.m@gmail.com>2008-06-30 19:26:22 -0400
commit9833aec6cbd113d24277aa5da8625c1427d831ca (patch)
treef7ee6ca969ad0d4c8e69efe69f058cbf568cfa36 /src/gallium/state_trackers/g3dvl
parent1c893fd513f5335a81dd72db70d64763634ea856 (diff)
g3dvl: Use block and stride instead of cpp and pitch.
Diffstat (limited to 'src/gallium/state_trackers/g3dvl')
-rw-r--r--src/gallium/state_trackers/g3dvl/vl_context.c2
-rw-r--r--src/gallium/state_trackers/g3dvl/vl_shader_build.c23
-rw-r--r--src/gallium/state_trackers/g3dvl/vl_surface.c29
3 files changed, 28 insertions, 26 deletions
diff --git a/src/gallium/state_trackers/g3dvl/vl_context.c b/src/gallium/state_trackers/g3dvl/vl_context.c
index 88da47c06a..bd8743dc9a 100644
--- a/src/gallium/state_trackers/g3dvl/vl_context.c
+++ b/src/gallium/state_trackers/g3dvl/vl_context.c
@@ -1407,7 +1407,7 @@ static int vlInitMC(struct VL_CONTEXT *context)
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);
diff --git a/src/gallium/state_trackers/g3dvl/vl_shader_build.c b/src/gallium/state_trackers/g3dvl/vl_shader_build.c
index fd9de7dab8..365ad69725 100644
--- a/src/gallium/state_trackers/g3dvl/vl_shader_build.c
+++ b/src/gallium/state_trackers/g3dvl/vl_shader_build.c
@@ -11,8 +11,8 @@ struct tgsi_full_declaration vl_decl_input(unsigned int name, unsigned int index
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;
}
@@ -39,10 +39,9 @@ struct tgsi_full_declaration vl_decl_interpolated_input
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;
}
@@ -55,8 +54,8 @@ struct tgsi_full_declaration vl_decl_constants(unsigned int name, unsigned int i
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;
}
@@ -69,8 +68,8 @@ struct tgsi_full_declaration vl_decl_output(unsigned int name, unsigned int inde
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;
}
@@ -81,8 +80,8 @@ struct tgsi_full_declaration vl_decl_samplers(unsigned int first, unsigned int l
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;
}
diff --git a/src/gallium/state_trackers/g3dvl/vl_surface.c b/src/gallium/state_trackers/g3dvl/vl_surface.c
index d2220d7abf..68313cc750 100644
--- a/src/gallium/state_trackers/g3dvl/vl_surface.c
+++ b/src/gallium/state_trackers/g3dvl/vl_surface.c
@@ -98,6 +98,7 @@ static int vlGrabBlocks
{
struct pipe_surface *tex_surface;
short *texels;
+ unsigned int tex_pitch;
unsigned int tb, sb = 0;
assert(context);
@@ -111,6 +112,7 @@ static int vlGrabBlocks
);
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)
{
@@ -121,35 +123,35 @@ static int vlGrabBlocks
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);
@@ -165,6 +167,7 @@ static int vlGrabBlocks
);
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)
{
@@ -173,20 +176,20 @@ static int vlGrabBlocks
(
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);
}
@@ -223,7 +226,7 @@ int vlCreateSurface(struct VL_CONTEXT *context, struct VL_SURFACE **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);