/**
- * Create LLVM type for struct draw_jit_sampler
- */
-static LLVMTypeRef
-create_jit_sampler_type(struct gallivm_state *gallivm, const char *struct_name)
-{
- LLVMTargetDataRef target = gallivm->target;
- LLVMTypeRef sampler_type;
- LLVMTypeRef elem_types[DRAW_JIT_SAMPLER_NUM_FIELDS];
-
- elem_types[DRAW_JIT_SAMPLER_MIN_LOD] =
- elem_types[DRAW_JIT_SAMPLER_MAX_LOD] =
- elem_types[DRAW_JIT_SAMPLER_LOD_BIAS] =
- elem_types[DRAW_JIT_SAMPLER_MAX_ANISO] = LLVMFloatTypeInContext(gallivm->context);
- elem_types[DRAW_JIT_SAMPLER_BORDER_COLOR] =
- LLVMArrayType(LLVMFloatTypeInContext(gallivm->context), 4);
-
- sampler_type = LLVMStructTypeInContext(gallivm->context, elem_types,
- ARRAY_SIZE(elem_types), 0);
-
- (void) target; /* silence unused var warning for non-debug build */
- LP_CHECK_MEMBER_OFFSET(struct draw_jit_sampler, min_lod,
- target, sampler_type,
- DRAW_JIT_SAMPLER_MIN_LOD);
- LP_CHECK_MEMBER_OFFSET(struct draw_jit_sampler, max_lod,
- target, sampler_type,
- DRAW_JIT_SAMPLER_MAX_LOD);
- LP_CHECK_MEMBER_OFFSET(struct draw_jit_sampler, lod_bias,
- target, sampler_type,
- DRAW_JIT_SAMPLER_LOD_BIAS);
- LP_CHECK_MEMBER_OFFSET(struct draw_jit_sampler, border_color,
- target, sampler_type,
- DRAW_JIT_SAMPLER_BORDER_COLOR);
- LP_CHECK_MEMBER_OFFSET(struct draw_jit_sampler, max_aniso,
- target, sampler_type,
- DRAW_JIT_SAMPLER_MAX_ANISO);
-
- LP_CHECK_STRUCT_SIZE(struct draw_jit_sampler, target, sampler_type);
-
- return sampler_type;
-}
-
-
-/**
* Create LLVM type for struct draw_jit_texture
*/
static LLVMTypeRef
{
LLVMTypeRef buffer_type = lp_build_create_jit_buffer_type(gallivm);
LLVMTypeRef texture_type = lp_build_create_jit_texture_type(gallivm);
- LLVMTypeRef sampler_type = create_jit_sampler_type(gallivm, "sampler");
+ LLVMTypeRef sampler_type = lp_build_create_jit_sampler_type(gallivm);
LLVMTypeRef image_type = create_jit_image_type(gallivm, "image");
LLVMTargetDataRef target = gallivm->target;
switch (shader_type) {
case PIPE_SHADER_VERTEX:
for (unsigned i = 0; i < draw->num_samplers[PIPE_SHADER_VERTEX]; i++) {
- struct draw_jit_sampler *jit_sam = &draw->llvm->jit_context.samplers[i];
+ struct lp_jit_sampler *jit_sam = &draw->llvm->jit_context.samplers[i];
if (draw->samplers[PIPE_SHADER_VERTEX][i]) {
const struct pipe_sampler_state *s
break;
case PIPE_SHADER_GEOMETRY:
for (unsigned i = 0; i < draw->num_samplers[PIPE_SHADER_GEOMETRY]; i++) {
- struct draw_jit_sampler *jit_sam = &draw->llvm->gs_jit_context.samplers[i];
+ struct lp_jit_sampler *jit_sam = &draw->llvm->gs_jit_context.samplers[i];
if (draw->samplers[PIPE_SHADER_GEOMETRY][i]) {
const struct pipe_sampler_state *s
break;
case PIPE_SHADER_TESS_CTRL:
for (unsigned i = 0; i < draw->num_samplers[PIPE_SHADER_TESS_CTRL]; i++) {
- struct draw_jit_sampler *jit_sam = &draw->llvm->tcs_jit_context.samplers[i];
+ struct lp_jit_sampler *jit_sam = &draw->llvm->tcs_jit_context.samplers[i];
if (draw->samplers[PIPE_SHADER_TESS_CTRL][i]) {
const struct pipe_sampler_state *s
break;
case PIPE_SHADER_TESS_EVAL:
for (unsigned i = 0; i < draw->num_samplers[PIPE_SHADER_TESS_EVAL]; i++) {
- struct draw_jit_sampler *jit_sam = &draw->llvm->tes_jit_context.samplers[i];
+ struct lp_jit_sampler *jit_sam = &draw->llvm->tes_jit_context.samplers[i];
if (draw->samplers[PIPE_SHADER_TESS_EVAL][i]) {
const struct pipe_sampler_state *s
LLVMTypeRef texture_type, sampler_type, image_type, buffer_type;
texture_type = lp_build_create_jit_texture_type(gallivm);
- sampler_type = create_jit_sampler_type(gallivm, "sampler");
+ sampler_type = lp_build_create_jit_sampler_type(gallivm);
image_type = create_jit_image_type(gallivm, "image");
buffer_type = lp_build_create_jit_buffer_type(gallivm);
LLVMTypeRef texture_type, sampler_type, image_type, buffer_type;
texture_type = lp_build_create_jit_texture_type(gallivm);
- sampler_type = create_jit_sampler_type(gallivm, "sampler");
+ sampler_type = lp_build_create_jit_sampler_type(gallivm);
image_type = create_jit_image_type(gallivm, "image");
buffer_type = lp_build_create_jit_buffer_type(gallivm);
LLVMTypeRef texture_type, sampler_type, image_type, buffer_type;
texture_type = lp_build_create_jit_texture_type(gallivm);
- sampler_type = create_jit_sampler_type(gallivm, "sampler");
+ sampler_type = lp_build_create_jit_sampler_type(gallivm);
image_type = create_jit_image_type(gallivm, "image");
buffer_type = lp_build_create_jit_buffer_type(gallivm);
struct lp_static_texture_state image_state;
};
-
-struct draw_jit_sampler
-{
- float min_lod;
- float max_lod;
- float lod_bias;
- float border_color[4];
- float max_aniso;
-};
-
-
struct draw_jit_image
{
uint32_t width;
};
enum {
- DRAW_JIT_SAMPLER_MIN_LOD,
- DRAW_JIT_SAMPLER_MAX_LOD,
- DRAW_JIT_SAMPLER_LOD_BIAS,
- DRAW_JIT_SAMPLER_BORDER_COLOR,
- DRAW_JIT_SAMPLER_MAX_ANISO,
- DRAW_JIT_SAMPLER_NUM_FIELDS /* number of fields above */
-};
-
-
-enum {
DRAW_JIT_VERTEX_VERTEX_ID = 0,
DRAW_JIT_VERTEX_CLIP_POS,
DRAW_JIT_VERTEX_DATA
struct pipe_viewport_state *viewports;
struct lp_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS];
- struct draw_jit_sampler samplers[PIPE_MAX_SAMPLERS];
+ struct lp_jit_sampler samplers[PIPE_MAX_SAMPLERS];
struct draw_jit_image images[PIPE_MAX_SHADER_IMAGES];
struct lp_jit_buffer ssbos[LP_MAX_TGSI_SHADER_BUFFERS];
/* There two need to be exactly at DRAW_JIT_CTX_TEXTURES and
* DRAW_JIT_CTX_SAMPLERS positions in the struct */
struct lp_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS];
- struct draw_jit_sampler samplers[PIPE_MAX_SAMPLERS];
+ struct lp_jit_sampler samplers[PIPE_MAX_SAMPLERS];
struct draw_jit_image images[PIPE_MAX_SHADER_IMAGES];
int **prim_lengths;
/* There two need to be exactly at DRAW_JIT_CTX_TEXTURES and
* DRAW_JIT_CTX_SAMPLERS positions in the struct */
struct lp_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS];
- struct draw_jit_sampler samplers[PIPE_MAX_SAMPLERS];
+ struct lp_jit_sampler samplers[PIPE_MAX_SAMPLERS];
struct draw_jit_image images[PIPE_MAX_SHADER_IMAGES];
struct lp_jit_buffer ssbos[LP_MAX_TGSI_SHADER_BUFFERS];
/* There two need to be exactly at DRAW_JIT_CTX_TEXTURES and
* DRAW_JIT_CTX_SAMPLERS positions in the struct */
struct lp_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS];
- struct draw_jit_sampler samplers[PIPE_MAX_SAMPLERS];
+ struct lp_jit_sampler samplers[PIPE_MAX_SAMPLERS];
struct draw_jit_image images[PIPE_MAX_SHADER_IMAGES];
struct lp_jit_buffer ssbos[LP_MAX_TGSI_SHADER_BUFFERS];
}
-DRAW_LLVM_SAMPLER_MEMBER(min_lod, DRAW_JIT_SAMPLER_MIN_LOD, TRUE)
-DRAW_LLVM_SAMPLER_MEMBER(max_lod, DRAW_JIT_SAMPLER_MAX_LOD, TRUE)
-DRAW_LLVM_SAMPLER_MEMBER(lod_bias, DRAW_JIT_SAMPLER_LOD_BIAS, TRUE)
-DRAW_LLVM_SAMPLER_MEMBER(border_color, DRAW_JIT_SAMPLER_BORDER_COLOR, FALSE)
-DRAW_LLVM_SAMPLER_MEMBER(max_aniso, DRAW_JIT_SAMPLER_MAX_ANISO, TRUE)
+DRAW_LLVM_SAMPLER_MEMBER(min_lod, LP_JIT_SAMPLER_MIN_LOD, TRUE)
+DRAW_LLVM_SAMPLER_MEMBER(max_lod, LP_JIT_SAMPLER_MAX_LOD, TRUE)
+DRAW_LLVM_SAMPLER_MEMBER(lod_bias, LP_JIT_SAMPLER_LOD_BIAS, TRUE)
+DRAW_LLVM_SAMPLER_MEMBER(border_color, LP_JIT_SAMPLER_BORDER_COLOR, FALSE)
+DRAW_LLVM_SAMPLER_MEMBER(max_aniso, LP_JIT_SAMPLER_MAX_ANISO, TRUE)
#define DRAW_LLVM_IMAGE_MEMBER(_name, _index, _emit_load) \
static LLVMValueRef \
gallivm->target, texture_type);
return texture_type;
}
+
+LLVMTypeRef
+lp_build_create_jit_sampler_type(struct gallivm_state *gallivm)
+{
+ LLVMContextRef lc = gallivm->context;
+ LLVMTypeRef sampler_type;
+ LLVMTypeRef elem_types[LP_JIT_SAMPLER_NUM_FIELDS];
+ elem_types[LP_JIT_SAMPLER_MIN_LOD] =
+ elem_types[LP_JIT_SAMPLER_MAX_LOD] =
+ elem_types[LP_JIT_SAMPLER_LOD_BIAS] =
+ elem_types[LP_JIT_SAMPLER_MAX_ANISO] = LLVMFloatTypeInContext(lc);
+ elem_types[LP_JIT_SAMPLER_BORDER_COLOR] =
+ LLVMArrayType(LLVMFloatTypeInContext(lc), 4);
+
+ sampler_type = LLVMStructTypeInContext(lc, elem_types,
+ ARRAY_SIZE(elem_types), 0);
+
+ LP_CHECK_MEMBER_OFFSET(struct lp_jit_sampler, min_lod,
+ gallivm->target, sampler_type,
+ LP_JIT_SAMPLER_MIN_LOD);
+ LP_CHECK_MEMBER_OFFSET(struct lp_jit_sampler, max_lod,
+ gallivm->target, sampler_type,
+ LP_JIT_SAMPLER_MAX_LOD);
+ LP_CHECK_MEMBER_OFFSET(struct lp_jit_sampler, lod_bias,
+ gallivm->target, sampler_type,
+ LP_JIT_SAMPLER_LOD_BIAS);
+ LP_CHECK_MEMBER_OFFSET(struct lp_jit_sampler, border_color,
+ gallivm->target, sampler_type,
+ LP_JIT_SAMPLER_BORDER_COLOR);
+ LP_CHECK_MEMBER_OFFSET(struct lp_jit_sampler, max_aniso,
+ gallivm->target, sampler_type,
+ LP_JIT_SAMPLER_MAX_ANISO);
+ LP_CHECK_STRUCT_SIZE(struct lp_jit_sampler,
+ gallivm->target, sampler_type);
+ return sampler_type;
+}
LLVMTypeRef
lp_build_create_jit_texture_type(struct gallivm_state *gallivm);
+struct lp_jit_sampler
+{
+ float min_lod;
+ float max_lod;
+ float lod_bias;
+ float border_color[4];
+ float max_aniso;
+};
+
+enum {
+ LP_JIT_SAMPLER_MIN_LOD,
+ LP_JIT_SAMPLER_MAX_LOD,
+ LP_JIT_SAMPLER_LOD_BIAS,
+ LP_JIT_SAMPLER_BORDER_COLOR,
+ LP_JIT_SAMPLER_MAX_ANISO,
+ LP_JIT_SAMPLER_NUM_FIELDS /* number of fields above */
+};
+
+LLVMTypeRef
+lp_build_create_jit_sampler_type(struct gallivm_state *gallivm);
+
#endif
#include "lp_jit.h"
static LLVMTypeRef
-create_jit_sampler_type(struct gallivm_state *gallivm)
-{
- LLVMContextRef lc = gallivm->context;
- LLVMTypeRef sampler_type;
- LLVMTypeRef elem_types[LP_JIT_SAMPLER_NUM_FIELDS];
- elem_types[LP_JIT_SAMPLER_MIN_LOD] =
- elem_types[LP_JIT_SAMPLER_MAX_LOD] =
- elem_types[LP_JIT_SAMPLER_LOD_BIAS] =
- elem_types[LP_JIT_SAMPLER_MAX_ANISO] = LLVMFloatTypeInContext(lc);
- elem_types[LP_JIT_SAMPLER_BORDER_COLOR] =
- LLVMArrayType(LLVMFloatTypeInContext(lc), 4);
-
- sampler_type = LLVMStructTypeInContext(lc, elem_types,
- ARRAY_SIZE(elem_types), 0);
-
- LP_CHECK_MEMBER_OFFSET(struct lp_jit_sampler, min_lod,
- gallivm->target, sampler_type,
- LP_JIT_SAMPLER_MIN_LOD);
- LP_CHECK_MEMBER_OFFSET(struct lp_jit_sampler, max_lod,
- gallivm->target, sampler_type,
- LP_JIT_SAMPLER_MAX_LOD);
- LP_CHECK_MEMBER_OFFSET(struct lp_jit_sampler, lod_bias,
- gallivm->target, sampler_type,
- LP_JIT_SAMPLER_LOD_BIAS);
- LP_CHECK_MEMBER_OFFSET(struct lp_jit_sampler, border_color,
- gallivm->target, sampler_type,
- LP_JIT_SAMPLER_BORDER_COLOR);
- LP_CHECK_MEMBER_OFFSET(struct lp_jit_sampler, max_aniso,
- gallivm->target, sampler_type,
- LP_JIT_SAMPLER_MAX_ANISO);
- LP_CHECK_STRUCT_SIZE(struct lp_jit_sampler,
- gallivm->target, sampler_type);
- return sampler_type;
-}
-
-static LLVMTypeRef
create_jit_image_type(struct gallivm_state *gallivm)
{
LLVMContextRef lc = gallivm->context;
buffer_type = lp_build_create_jit_buffer_type(gallivm);
texture_type = lp_build_create_jit_texture_type(gallivm);
- sampler_type = create_jit_sampler_type(gallivm);
+ sampler_type = lp_build_create_jit_sampler_type(gallivm);
image_type = create_jit_image_type(gallivm);
/* struct lp_jit_context */
buffer_type = lp_build_create_jit_buffer_type(gallivm);
texture_type = lp_build_create_jit_texture_type(gallivm);
- sampler_type = create_jit_sampler_type(gallivm);
+ sampler_type = lp_build_create_jit_sampler_type(gallivm);
image_type = create_jit_image_type(gallivm);
/* struct lp_jit_cs_thread_data */
struct lp_rast_state;
struct llvmpipe_screen;
-struct lp_jit_sampler
-{
- float min_lod;
- float max_lod;
- float lod_bias;
- float border_color[4];
- float max_aniso;
-};
-
-
struct lp_jit_viewport
{
float min_depth;
float max_depth;
};
-
struct lp_jit_image
{
uint32_t width; /* same as number of elements */
};
enum {
- LP_JIT_SAMPLER_MIN_LOD,
- LP_JIT_SAMPLER_MAX_LOD,
- LP_JIT_SAMPLER_LOD_BIAS,
- LP_JIT_SAMPLER_BORDER_COLOR,
- LP_JIT_SAMPLER_MAX_ANISO,
- LP_JIT_SAMPLER_NUM_FIELDS /* number of fields above */
-};
-
-
-enum {
LP_JIT_VIEWPORT_MIN_DEPTH,
LP_JIT_VIEWPORT_MAX_DEPTH,
LP_JIT_VIEWPORT_NUM_FIELDS /* number of fields above */