Commit ad88ac79 authored by Keith Whitwell's avatar Keith Whitwell

Merge branch 'gallium-sampler-view' into gallium-resources

Conflicts:
	src/gallium/auxiliary/cso_cache/cso_context.c
	src/gallium/auxiliary/util/u_blit.c
	src/gallium/drivers/llvmpipe/lp_texture.c
	src/gallium/drivers/softpipe/sp_texture.c
	src/mesa/state_tracker/st_cb_fbo.c
	src/mesa/state_tracker/st_framebuffer.c
	src/mesa/state_tracker/st_texture.c
parents 77bc770c 8cdfd121
......@@ -88,9 +88,9 @@ LoadSkyBoxCubeTexture(const char *filePosX,
return 0;
if (!load(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, fileNegX, GL_TRUE, GL_TRUE))
return 0;
if (!load(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, filePosY, 1+GL_FALSE, GL_TRUE))
if (!load(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, filePosY, GL_TRUE, GL_TRUE))
return 0;
if (!load(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, fileNegY, 1+GL_FALSE, GL_TRUE))
if (!load(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, fileNegY, GL_TRUE, GL_TRUE))
return 0;
if (!load(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, filePosZ, GL_TRUE, GL_TRUE))
return 0;
......
......@@ -71,16 +71,12 @@ struct cso_context {
unsigned nr_vertex_samplers_saved;
void *vertex_samplers_saved[PIPE_MAX_VERTEX_SAMPLERS];
struct pipe_resource *textures[PIPE_MAX_SAMPLERS];
uint nr_fragment_sampler_views;
struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS];
uint nr_textures;
uint nr_vertex_sampler_views;
struct pipe_sampler_view *vertex_sampler_views[PIPE_MAX_VERTEX_SAMPLERS];
uint nr_textures_saved;
struct pipe_resource *textures_saved[PIPE_MAX_SAMPLERS];
uint nr_fragment_sampler_views_saved;
struct pipe_sampler_view *fragment_sampler_views_saved[PIPE_MAX_SAMPLERS];
......@@ -299,8 +295,6 @@ void cso_release_all( struct cso_context *ctx )
}
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
pipe_resource_reference(&ctx->textures[i], NULL);
pipe_resource_reference(&ctx->textures_saved[i], NULL);
pipe_sampler_view_reference(&ctx->fragment_sampler_views[i], NULL);
pipe_sampler_view_reference(&ctx->fragment_sampler_views_saved[i], NULL);
}
......@@ -630,7 +624,7 @@ enum pipe_error cso_set_sampler_textures( struct cso_context *ctx,
{
uint i;
ctx->nr_textures = count;
ctx->nr_fragment_sampler_views = count;
for (i = 0; i < count; i++) {
struct pipe_sampler_view templ, *view;
......@@ -638,15 +632,14 @@ enum pipe_error cso_set_sampler_textures( struct cso_context *ctx,
u_sampler_view_default_template(&templ,
textures[i],
textures[i]->format);
view = ctx->pipe->create_sampler_view(ctx->pipe,
textures[i],
&templ);
pipe_resource_reference(&ctx->textures[i], textures[i]);
pipe_sampler_view_reference(&ctx->fragment_sampler_views[i], view);
}
for ( ; i < PIPE_MAX_SAMPLERS; i++) {
pipe_resource_reference(&ctx->textures[i], NULL);
pipe_sampler_view_reference(&ctx->fragment_sampler_views[i], NULL);
}
......@@ -661,12 +654,10 @@ void cso_save_sampler_textures( struct cso_context *ctx )
{
uint i;
ctx->nr_textures_saved = ctx->nr_textures;
for (i = 0; i < ctx->nr_textures; i++) {
assert(!ctx->textures_saved[i]);
ctx->nr_fragment_sampler_views_saved = ctx->nr_fragment_sampler_views;
for (i = 0; i < ctx->nr_fragment_sampler_views; i++) {
assert(!ctx->fragment_sampler_views_saved[i]);
pipe_resource_reference(&ctx->textures_saved[i], ctx->textures[i]);
pipe_sampler_view_reference(&ctx->fragment_sampler_views_saved[i],
ctx->fragment_sampler_views[i]);
}
......@@ -676,27 +667,22 @@ void cso_restore_sampler_textures( struct cso_context *ctx )
{
uint i;
ctx->nr_textures = ctx->nr_textures_saved;
for (i = 0; i < ctx->nr_textures; i++) {
pipe_resource_reference(&ctx->textures[i], NULL);
ctx->textures[i] = ctx->textures_saved[i];
ctx->textures_saved[i] = NULL;
ctx->nr_fragment_sampler_views = ctx->nr_fragment_sampler_views_saved;
for (i = 0; i < ctx->nr_fragment_sampler_views; i++) {
pipe_sampler_view_reference(&ctx->fragment_sampler_views[i], NULL);
ctx->fragment_sampler_views[i] = ctx->fragment_sampler_views_saved[i];
ctx->fragment_sampler_views_saved[i] = NULL;
}
for ( ; i < PIPE_MAX_SAMPLERS; i++) {
pipe_resource_reference(&ctx->textures[i], NULL);
pipe_sampler_view_reference(&ctx->fragment_sampler_views[i], NULL);
}
ctx->pipe->set_fragment_sampler_views(ctx->pipe,
ctx->nr_textures,
ctx->nr_fragment_sampler_views,
ctx->fragment_sampler_views);
ctx->nr_textures_saved = 0;
ctx->nr_fragment_sampler_views_saved = 0;
}
......
......@@ -31,8 +31,8 @@
*/
#ifndef OS_LLVM_H
#define OS_LLVM_H
#ifndef LP_BLD_H
#define LP_BLD_H
#include <llvm-c/Core.h>
......@@ -40,8 +40,8 @@
/** Set version to 0 if missing to avoid #ifdef HAVE_LLVM everywhere */
#ifndef HAVE_LLVM
#define HAVE_LLVM 0x0
#define HAVE_LLVM 0x0207
#endif
#endif /* OS_LLVM_H */
#endif /* LP_BLD_H */
......@@ -35,7 +35,7 @@
#define LP_BLD_ALPHA_H
#include "os/os_llvm.h"
#include "gallivm/lp_bld.h"
struct pipe_alpha_state;
struct lp_type;
......
This diff is collapsed.
......@@ -37,7 +37,7 @@
#define LP_BLD_ARIT_H
#include "os/os_llvm.h"
#include "gallivm/lp_bld.h"
struct lp_type;
......
......@@ -40,7 +40,7 @@
* for a standalone example.
*/
#include "os/os_llvm.h"
#include "gallivm/lp_bld.h"
#include "pipe/p_format.h"
......
......@@ -263,7 +263,7 @@ lp_build_one(struct lp_type type)
if(type.sign)
/* TODO: Unfortunately this caused "Tried to create a shift operation
* on a non-integer type!" */
vec = LLVMConstLShr(vec, lp_build_int_const_scalar(type, 1));
vec = LLVMConstLShr(vec, lp_build_const_int_vec(type, 1));
#endif
return vec;
......@@ -283,8 +283,8 @@ lp_build_one(struct lp_type type)
* Build constant-valued vector from a scalar value.
*/
LLVMValueRef
lp_build_const_scalar(struct lp_type type,
double val)
lp_build_const_vec(struct lp_type type,
double val)
{
LLVMTypeRef elem_type = lp_build_elem_type(type);
LLVMValueRef elems[LP_MAX_VECTOR_LENGTH];
......@@ -309,7 +309,7 @@ lp_build_const_scalar(struct lp_type type,
LLVMValueRef
lp_build_int_const_scalar(struct lp_type type,
lp_build_const_int_vec(struct lp_type type,
long long val)
{
LLVMTypeRef elem_type = lp_build_int_elem_type(type);
......
......@@ -37,9 +37,9 @@
#define LP_BLD_CONST_H
#include "os/os_llvm.h"
#include "pipe/p_compiler.h"
#include "gallivm/lp_bld.h"
#include <pipe/p_compiler.h>
struct lp_type;
......@@ -85,13 +85,11 @@ lp_build_one(struct lp_type type);
LLVMValueRef
lp_build_const_scalar(struct lp_type type,
double val);
lp_build_const_vec(struct lp_type type, double val);
LLVMValueRef
lp_build_int_const_scalar(struct lp_type type,
long long val);
lp_build_const_int_vec(struct lp_type type, long long val);
LLVMValueRef
......
......@@ -114,13 +114,13 @@ lp_build_clamped_float_to_unsigned_norm(LLVMBuilderRef builder,
scale = (double)mask/ubound;
bias = (double)((unsigned long long)1 << (mantissa - n));
res = LLVMBuildMul(builder, src, lp_build_const_scalar(src_type, scale), "");
res = LLVMBuildAdd(builder, res, lp_build_const_scalar(src_type, bias), "");
res = LLVMBuildMul(builder, src, lp_build_const_vec(src_type, scale), "");
res = LLVMBuildAdd(builder, res, lp_build_const_vec(src_type, bias), "");
res = LLVMBuildBitCast(builder, res, int_vec_type, "");
if(dst_width > n) {
int shift = dst_width - n;
res = LLVMBuildShl(builder, res, lp_build_int_const_scalar(src_type, shift), "");
res = LLVMBuildShl(builder, res, lp_build_const_int_vec(src_type, shift), "");
/* TODO: Fill in the empty lower bits for additional precision? */
/* YES: this fixes progs/trivial/tri-z-eq.c.
......@@ -130,21 +130,21 @@ lp_build_clamped_float_to_unsigned_norm(LLVMBuilderRef builder,
#if 0
{
LLVMValueRef msb;
msb = LLVMBuildLShr(builder, res, lp_build_int_const_scalar(src_type, dst_width - 1), "");
msb = LLVMBuildShl(builder, msb, lp_build_int_const_scalar(src_type, shift), "");
msb = LLVMBuildSub(builder, msb, lp_build_int_const_scalar(src_type, 1), "");
msb = LLVMBuildLShr(builder, res, lp_build_const_int_vec(src_type, dst_width - 1), "");
msb = LLVMBuildShl(builder, msb, lp_build_const_int_vec(src_type, shift), "");
msb = LLVMBuildSub(builder, msb, lp_build_const_int_vec(src_type, 1), "");
res = LLVMBuildOr(builder, res, msb, "");
}
#elif 0
while(shift > 0) {
res = LLVMBuildOr(builder, res, LLVMBuildLShr(builder, res, lp_build_int_const_scalar(src_type, n), ""), "");
res = LLVMBuildOr(builder, res, LLVMBuildLShr(builder, res, lp_build_const_int_vec(src_type, n), ""), "");
shift -= n;
n *= 2;
}
#endif
}
else
res = LLVMBuildAnd(builder, res, lp_build_int_const_scalar(src_type, mask), "");
res = LLVMBuildAnd(builder, res, lp_build_const_int_vec(src_type, mask), "");
return res;
}
......@@ -183,10 +183,10 @@ lp_build_unsigned_norm_to_float(LLVMBuilderRef builder,
if(src_width > mantissa) {
int shift = src_width - mantissa;
res = LLVMBuildLShr(builder, res, lp_build_int_const_scalar(dst_type, shift), "");
res = LLVMBuildLShr(builder, res, lp_build_const_int_vec(dst_type, shift), "");
}
bias_ = lp_build_const_scalar(dst_type, bias);
bias_ = lp_build_const_vec(dst_type, bias);
res = LLVMBuildOr(builder,
res,
......@@ -195,7 +195,7 @@ lp_build_unsigned_norm_to_float(LLVMBuilderRef builder,
res = LLVMBuildBitCast(builder, res, vec_type, "");
res = LLVMBuildSub(builder, res, bias_, "");
res = LLVMBuildMul(builder, res, lp_build_const_scalar(dst_type, scale), "");
res = LLVMBuildMul(builder, res, lp_build_const_vec(dst_type, scale), "");
return res;
}
......@@ -251,7 +251,7 @@ lp_build_conv(LLVMBuilderRef builder,
if(dst_min == 0.0)
thres = bld.zero;
else
thres = lp_build_const_scalar(src_type, dst_min);
thres = lp_build_const_vec(src_type, dst_min);
for(i = 0; i < num_tmps; ++i)
tmp[i] = lp_build_max(&bld, tmp[i], thres);
}
......@@ -260,7 +260,7 @@ lp_build_conv(LLVMBuilderRef builder,
if(dst_max == 1.0)
thres = bld.one;
else
thres = lp_build_const_scalar(src_type, dst_max);
thres = lp_build_const_vec(src_type, dst_max);
for(i = 0; i < num_tmps; ++i)
tmp[i] = lp_build_min(&bld, tmp[i], thres);
}
......@@ -288,7 +288,7 @@ lp_build_conv(LLVMBuilderRef builder,
LLVMTypeRef tmp_vec_type;
if (dst_scale != 1.0) {
LLVMValueRef scale = lp_build_const_scalar(tmp_type, dst_scale);
LLVMValueRef scale = lp_build_const_vec(tmp_type, dst_scale);
for(i = 0; i < num_tmps; ++i)
tmp[i] = LLVMBuildMul(builder, tmp[i], scale, "");
}
......@@ -315,7 +315,7 @@ lp_build_conv(LLVMBuilderRef builder,
/* FIXME: compensate different offsets too */
if(src_shift > dst_shift) {
LLVMValueRef shift = lp_build_int_const_scalar(tmp_type, src_shift - dst_shift);
LLVMValueRef shift = lp_build_const_int_vec(tmp_type, src_shift - dst_shift);
for(i = 0; i < num_tmps; ++i)
if(src_type.sign)
tmp[i] = LLVMBuildAShr(builder, tmp[i], shift, "");
......@@ -388,7 +388,7 @@ lp_build_conv(LLVMBuilderRef builder,
}
if (src_scale != 1.0) {
LLVMValueRef scale = lp_build_const_scalar(tmp_type, 1.0/src_scale);
LLVMValueRef scale = lp_build_const_vec(tmp_type, 1.0/src_scale);
for(i = 0; i < num_tmps; ++i)
tmp[i] = LLVMBuildMul(builder, tmp[i], scale, "");
}
......@@ -400,7 +400,7 @@ lp_build_conv(LLVMBuilderRef builder,
/* FIXME: compensate different offsets too */
if(src_shift < dst_shift) {
LLVMValueRef shift = lp_build_int_const_scalar(tmp_type, dst_shift - src_shift);
LLVMValueRef shift = lp_build_const_int_vec(tmp_type, dst_shift - src_shift);
for(i = 0; i < num_tmps; ++i)
tmp[i] = LLVMBuildShl(builder, tmp[i], shift, "");
}
......
......@@ -37,7 +37,7 @@
#define LP_BLD_CONV_H
#include "os/os_llvm.h"
#include "gallivm/lp_bld.h"
struct lp_type;
......
......@@ -30,7 +30,7 @@
#define LP_BLD_DEBUG_H
#include "os/os_llvm.h"
#include "gallivm/lp_bld.h"
#include "pipe/p_compiler.h"
#include "util/u_string.h"
......
......@@ -61,11 +61,104 @@
#include "util/u_format.h"
#include "lp_bld_type.h"
#include "lp_bld_arit.h"
#include "lp_bld_const.h"
#include "lp_bld_logic.h"
#include "lp_bld_flow.h"
#include "lp_bld_debug.h"
#include "lp_bld_depth.h"
#include "lp_bld_swizzle.h"
/**
* Do the stencil test comparison (compare fb Z values against ref value.
* \param stencilVals vector of stencil values from framebuffer
* \param stencilRef the stencil reference value, replicated as a vector
* \return mask of pass/fail values
*/
static LLVMValueRef
lp_build_stencil_test(struct lp_build_context *bld,
const struct pipe_stencil_state *stencil,
LLVMValueRef stencilVals,
LLVMValueRef stencilRef)
{
const unsigned stencilMax = 255; /* XXX fix */
struct lp_type type = bld->type;
LLVMValueRef res;
assert(stencil->enabled);
if (stencil->valuemask != stencilMax) {
/* compute stencilRef = stencilRef & valuemask */
LLVMValueRef valuemask = lp_build_const_int_vec(type, stencil->valuemask);
stencilRef = LLVMBuildAnd(bld->builder, stencilRef, valuemask, "");
/* compute stencilVals = stencilVals & valuemask */
stencilVals = LLVMBuildAnd(bld->builder, stencilVals, valuemask, "");
}
res = lp_build_compare(bld->builder, bld->type, stencil->func,
stencilVals, stencilRef);
return res;
}
/**
* Apply the stencil operator (add/sub/keep/etc) to the given vector
* of stencil values.
* \return new stencil values vector
*/
static LLVMValueRef
lp_build_stencil_op(struct lp_build_context *bld,
unsigned stencil_op,
LLVMValueRef stencilRef,
const struct pipe_stencil_state *stencil,
LLVMValueRef stencilVals)
{
const unsigned stencilMax = 255; /* XXX fix */
struct lp_type type = bld->type;
LLVMValueRef res;
LLVMValueRef max = lp_build_const_int_vec(type, stencilMax);
switch (stencil_op) {
case PIPE_STENCIL_OP_KEEP:
res = stencilVals;
case PIPE_STENCIL_OP_ZERO:
res = bld->zero;
case PIPE_STENCIL_OP_REPLACE:
res = lp_build_broadcast_scalar(bld, stencilRef);
case PIPE_STENCIL_OP_INCR:
res = lp_build_add(bld, stencilVals, bld->one);
res = lp_build_min(bld, res, max);
case PIPE_STENCIL_OP_DECR:
res = lp_build_sub(bld, stencilVals, bld->one);
res = lp_build_max(bld, res, bld->zero);
case PIPE_STENCIL_OP_INCR_WRAP:
res = lp_build_add(bld, stencilVals, bld->one);
res = LLVMBuildAnd(bld->builder, res, max, "");
case PIPE_STENCIL_OP_DECR_WRAP:
res = lp_build_sub(bld, stencilVals, bld->one);
res = LLVMBuildAnd(bld->builder, res, max, "");
case PIPE_STENCIL_OP_INVERT:
res = LLVMBuildNot(bld->builder, stencilVals, "");
default:
assert(0 && "bad stencil op mode");
res = NULL;
}
if (stencil->writemask != stencilMax) {
/* compute res = (res & mask) | (stencilVals & ~mask) */
LLVMValueRef mask = lp_build_const_int_vec(type, stencil->writemask);
LLVMValueRef cmask = LLVMBuildNot(bld->builder, mask, "notWritemask");
LLVMValueRef t1 = LLVMBuildAnd(bld->builder, res, mask, "t1");
LLVMValueRef t2 = LLVMBuildAnd(bld->builder, stencilVals, cmask, "t2");
res = LLVMBuildOr(bld->builder, t1, t2, "t1_or_t2");
}
return res;
}
/**
......@@ -109,7 +202,14 @@ lp_depth_type(const struct util_format_description *format_desc,
/**
* Depth test.
* Generate code for performing depth and/or stencil tests.
* We operate on a vector of values (typically a 2x2 quad).
*
* \param type the data type of the fragment depth/stencil values
* \param format_desc description of the depth/stencil surface
* \param mask the alive/dead pixel mask for the quad
* \param src the incoming depth/stencil values (a 2x2 quad)
* \param dst_ptr the outgoing/updated depth/stencil values
*/
void
lp_build_depth_test(LLVMBuilderRef builder,
......@@ -126,6 +226,9 @@ lp_build_depth_test(LLVMBuilderRef builder,
LLVMValueRef z_bitmask = NULL;
LLVMValueRef test;
(void) lp_build_stencil_test;
(void) lp_build_stencil_op;
if(!state->enabled)
return;
......@@ -185,11 +288,11 @@ lp_build_depth_test(LLVMBuilderRef builder,
if(padding_left || padding_right) {
const unsigned long long mask_left = ((unsigned long long)1 << (format_desc->block.bits - padding_left)) - 1;
const unsigned long long mask_right = ((unsigned long long)1 << (padding_right)) - 1;
z_bitmask = lp_build_int_const_scalar(type, mask_left ^ mask_right);
z_bitmask = lp_build_const_int_vec(type, mask_left ^ mask_right);
}
if(padding_left)
src = LLVMBuildLShr(builder, src, lp_build_int_const_scalar(type, padding_left), "");
src = LLVMBuildLShr(builder, src, lp_build_const_int_vec(type, padding_left), "");
if(padding_right)
src = LLVMBuildAnd(builder, src, z_bitmask, "");
if(padding_left || padding_right)
......@@ -198,6 +301,7 @@ lp_build_depth_test(LLVMBuilderRef builder,
lp_build_name(dst, "zsbuf.z");
/* compare src Z to dst Z, returning 'pass' mask */
test = lp_build_cmp(&bld, state->func, src, dst);
lp_build_mask_update(mask, test);
......
......@@ -36,7 +36,7 @@
#define LP_BLD_DEPTH_H
#include "os/os_llvm.h"
#include "gallivm/lp_bld.h"
struct pipe_depth_state;
......
......@@ -35,7 +35,7 @@
#define LP_BLD_FLOW_H
#include "os/os_llvm.h"
#include "gallivm/lp_bld.h"
struct lp_type;
......
......@@ -34,7 +34,7 @@
* Pixel format helpers.
*/
#include "os/os_llvm.h"
#include "gallivm/lp_bld.h"
#include "pipe/p_format.h"
......
......@@ -114,10 +114,10 @@ lp_build_unpack_rgba_soa(LLVMBuilderRef builder,
case UTIL_FORMAT_TYPE_UNSIGNED:
if(type.floating) {
if(start)
input = LLVMBuildLShr(builder, input, lp_build_int_const_scalar(type, start), "");
input = LLVMBuildLShr(builder, input, lp_build_const_int_vec(type, start), "");
if(stop < format_desc->block.bits) {
unsigned mask = ((unsigned long long)1 << width) - 1;
input = LLVMBuildAnd(builder, input, lp_build_int_const_scalar(type, mask), "");
input = LLVMBuildAnd(builder, input, lp_build_const_int_vec(type, mask), "");
}
if(format_desc->channel[chan].normalized)
......
......@@ -289,17 +289,17 @@ pos_update(struct lp_build_interp_soa_context *bld, int quad_index)
/* top-right or bottom-right quad in block */
/* build x += xstep */
x = lp_build_add(&bld->base, x,
lp_build_const_scalar(bld->base.type, xstep));
lp_build_const_vec(bld->base.type, xstep));
}
if (quad_index == 2) {
/* bottom-left quad in block */
/* build y += ystep */
y = lp_build_add(&bld->base, y,
lp_build_const_scalar(bld->base.type, ystep));
lp_build_const_vec(bld->base.type, ystep));
/* build x -= xstep */
x = lp_build_sub(&bld->base, x,
lp_build_const_scalar(bld->base.type, xstep));
lp_build_const_vec(bld->base.type, xstep));
}
lp_build_name(x, "pos.x");
......
......@@ -41,7 +41,7 @@
#define LP_BLD_INTERP_H
#include "os/os_llvm.h"
#include "gallivm/lp_bld.h"
#include "tgsi/tgsi_exec.h"
......
......@@ -37,7 +37,7 @@
#define LP_BLD_INTR_H
#include "os/os_llvm.h"
#include "gallivm/lp_bld.h"
/**
......
......@@ -193,7 +193,7 @@ lp_build_compare(LLVMBuilderRef builder,
if(table[func].gt &&
((type.width == 8 && type.sign) ||
(type.width != 8 && !type.sign))) {
LLVMValueRef msb = lp_build_int_const_scalar(type, (unsigned long long)1 << (type.width - 1));
LLVMValueRef msb = lp_build_const_int_vec(type, (unsigned long long)1 << (type.width - 1));
a = LLVMBuildXor(builder, a, msb, "");
b = LLVMBuildXor(builder, b, msb, "");
}
......
......@@ -37,7 +37,7 @@
#define LP_BLD_LOGIC_H
#include "os/os_llvm.h"
#include "gallivm/lp_bld.h"
#include "pipe/p_defines.h" /* For PIPE_FUNC_xxx */
......
......@@ -164,7 +164,7 @@ lp_build_unpack2(LLVMBuilderRef builder,
if(dst_type.sign && src_type.sign) {
/* Replicate the sign bit in the most significant bits */
msb = LLVMBuildAShr(builder, src, lp_build_int_const_scalar(src_type, src_type.width - 1), "");
msb = LLVMBuildAShr(builder, src, lp_build_const_int_vec(src_type, src_type.width - 1), "");
}
else
/* Most significant bits always zero */
......@@ -361,7 +361,7 @@ lp_build_packs2(LLVMBuilderRef builder,
if(clamp) {
struct lp_build_context bld;
unsigned dst_bits = dst_type.sign ? dst_type.width - 1 : dst_type.width;
LLVMValueRef dst_max = lp_build_int_const_scalar(src_type, ((unsigned long long)1 << dst_bits) - 1);
LLVMValueRef dst_max = lp_build_const_int_vec(src_type, ((unsigned long long)1 << dst_bits) - 1);
lp_build_context_init(&bld, builder, src_type);
lo = lp_build_min(&bld, lo, dst_max);
hi = lp_build_min(&bld, hi, dst_max);
......
......@@ -37,7 +37,7 @@
#define LP_BLD_PACK_H
#include "os/os_llvm.h"
#include "gallivm/lp_bld.h"
struct lp_type;
......
......@@ -173,7 +173,7 @@ lp_build_sample_offset(struct lp_build_context *bld,
LLVMValueRef x_stride;
LLVMValueRef offset;
x_stride = lp_build_const_scalar(bld->type, format_desc->block.bits/8);
x_stride = lp_build_const_vec(bld->type, format_desc->block.bits/8);
if(format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) {
LLVMValueRef x_lo, x_hi;
......@@ -195,9 +195,9 @@ lp_build_sample_offset(struct lp_build_context *bld,
y_hi = LLVMBuildLShr(bld->builder, y, bld->one, "");
x_stride_lo = x_stride;
y_stride_lo = lp_build_const_scalar(bld->type, 2*format_desc->block.bits/8);
y_stride_lo = lp_build_const_vec(bld->type, 2*format_desc->block.bits/8);
x_stride_hi = lp_build_const_scalar(bld->type, 4*format_desc->block.bits/8);
x_stride_hi = lp_build_const_vec(bld->type, 4*format_desc->block.bits/8);
y_stride_hi = LLVMBuildShl(bld->builder, y_stride, bld->one, "");
x_offset_lo = lp_build_mul(bld, x_lo, x_stride_lo);
......
......@@ -36,7 +36,7 @@
#define LP_BLD_SAMPLE_H
#include "os/os_llvm.h"
#include "gallivm/lp_bld.h"
struct pipe_resource;
</