projects
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
081ce26
)
llvmpipe: twoside for specular color also
author
Keith Whitwell
<keithw@vmware.com>
Fri, 19 Nov 2010 16:17:36 +0000
(16:17 +0000)
committer
Keith Whitwell
<keithw@vmware.com>
Fri, 19 Nov 2010 16:17:36 +0000
(16:17 +0000)
src/gallium/drivers/llvmpipe/lp_context.h
patch
|
blob
|
history
src/gallium/drivers/llvmpipe/lp_state_derived.c
patch
|
blob
|
history
src/gallium/drivers/llvmpipe/lp_state_setup.c
patch
|
blob
|
history
src/gallium/drivers/llvmpipe/lp_state_setup.h
patch
|
blob
|
history
diff --git
a/src/gallium/drivers/llvmpipe/lp_context.h
b/src/gallium/drivers/llvmpipe/lp_context.h
index 4515dbb0af135ef6958ba0574c340ade94592b74..a35e09e8b47130f0e0771582cddea13dc029bf15 100644
(file)
--- a/
src/gallium/drivers/llvmpipe/lp_context.h
+++ b/
src/gallium/drivers/llvmpipe/lp_context.h
@@
-105,10
+105,10
@@
struct llvmpipe_context {
struct vertex_info vertex_info;
/** Which vertex shader output slot contains color */
struct vertex_info vertex_info;
/** Which vertex shader output slot contains color */
- int color_slot;
+ int color_slot
[2]
;
/** Which vertex shader output slot contains bcolor */
/** Which vertex shader output slot contains bcolor */
- int bcolor_slot;
+ int bcolor_slot
[2]
;
/** Which vertex shader output slot contains point size */
int psize_slot;
/** Which vertex shader output slot contains point size */
int psize_slot;
diff --git
a/src/gallium/drivers/llvmpipe/lp_state_derived.c
b/src/gallium/drivers/llvmpipe/lp_state_derived.c
index 1c9f03a381c8d5e32e077c25b1cc103bbf12f6ec..8725ea39fe971f8523a658d880bd194630c6d658 100644
(file)
--- a/
src/gallium/drivers/llvmpipe/lp_state_derived.c
+++ b/
src/gallium/drivers/llvmpipe/lp_state_derived.c
@@
-53,6
+53,11
@@
compute_vertex_info(struct llvmpipe_context *llvmpipe)
unsigned vs_index;
uint i;
unsigned vs_index;
uint i;
+ llvmpipe->color_slot[0] = ~0;
+ llvmpipe->color_slot[1] = ~0;
+ llvmpipe->bcolor_slot[0] = ~0;
+ llvmpipe->bcolor_slot[1] = ~0;
+
/*
* Match FS inputs against VS outputs, emitting the necessary
* attributes. Could cache these structs and look them up with a
/*
* Match FS inputs against VS outputs, emitting the necessary
* attributes. Could cache these structs and look them up with a
@@
-75,9
+80,13
@@
compute_vertex_info(struct llvmpipe_context *llvmpipe)
vs_index = draw_find_shader_output(llvmpipe->draw,
lpfs->info.base.input_semantic_name[i],
lpfs->info.base.input_semantic_index[i]);
vs_index = draw_find_shader_output(llvmpipe->draw,
lpfs->info.base.input_semantic_name[i],
lpfs->info.base.input_semantic_index[i]);
- if (lpfs->info.base.input_semantic_name[i]==TGSI_SEMANTIC_COLOR){
- llvmpipe->color_slot = vinfo->num_attribs;
+
+ if (lpfs->info.base.input_semantic_name[i] == TGSI_SEMANTIC_COLOR &&
+ lpfs->info.base.input_semantic_index[i] < 2) {
+ int idx = lpfs->info.base.input_semantic_index[i];
+ llvmpipe->color_slot[idx] = vinfo->num_attribs;
}
}
+
/*
* Emit the requested fs attribute for all but position.
*/
/*
* Emit the requested fs attribute for all but position.
*/
@@
-86,14
+95,17
@@
compute_vertex_info(struct llvmpipe_context *llvmpipe)
/* Figure out if we need bcolor as well.
*/
/* Figure out if we need bcolor as well.
*/
- vs_index = draw_find_shader_output(llvmpipe->draw,
- TGSI_SEMANTIC_BCOLOR, 0);
+ for (i = 0; i < 2; i++) {
+ vs_index = draw_find_shader_output(llvmpipe->draw,
+ TGSI_SEMANTIC_BCOLOR, i);
- if (vs_index > 0) {
- llvmpipe->bcolor_slot = vinfo->num_attribs;
- draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, vs_index);
+ if (vs_index > 0) {
+ llvmpipe->bcolor_slot[i] = vinfo->num_attribs;
+ draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, vs_index);
+ }
}
}
+
/* Figure out if we need pointsize as well.
*/
vs_index = draw_find_shader_output(llvmpipe->draw,
/* Figure out if we need pointsize as well.
*/
vs_index = draw_find_shader_output(llvmpipe->draw,
diff --git
a/src/gallium/drivers/llvmpipe/lp_state_setup.c
b/src/gallium/drivers/llvmpipe/lp_state_setup.c
index 129ec0af3de2b044f086181ea92ffa923db46d3b..194b014436541a3e62b3d595fe2257a7cd310a0b 100644
(file)
--- a/
src/gallium/drivers/llvmpipe/lp_state_setup.c
+++ b/
src/gallium/drivers/llvmpipe/lp_state_setup.c
@@
-218,10
+218,11
@@
vert_clamp(LLVMBuilderRef b,
static void
lp_twoside(LLVMBuilderRef b,
struct lp_setup_args *args,
static void
lp_twoside(LLVMBuilderRef b,
struct lp_setup_args *args,
- const struct lp_setup_variant_key *key)
+ const struct lp_setup_variant_key *key,
+ int bcolor_slot)
{
LLVMValueRef a0_back, a1_back, a2_back;
{
LLVMValueRef a0_back, a1_back, a2_back;
- LLVMValueRef idx2 = LLVMConstInt(LLVMInt32Type(),
key->
bcolor_slot, 0);
+ LLVMValueRef idx2 = LLVMConstInt(LLVMInt32Type(), bcolor_slot, 0);
LLVMValueRef facing = args->facing;
LLVMValueRef front_facing = LLVMBuildICmp(b, LLVMIntEQ, facing, LLVMConstInt(LLVMInt32Type(), 0, 0), ""); /** need i1 for if condition */
LLVMValueRef facing = args->facing;
LLVMValueRef front_facing = LLVMBuildICmp(b, LLVMIntEQ, facing, LLVMConstInt(LLVMInt32Type(), 0, 0), ""); /** need i1 for if condition */
@@
-335,8
+336,11
@@
load_attribute(LLVMBuilderRef b,
lp_do_offset_tri(b, args, key);
}
lp_do_offset_tri(b, args, key);
}
- if (key->twoside && vert_attr == key->color_slot) {
- lp_twoside(b, args, key);
+ if (key->twoside) {
+ if (vert_attr == key->color_slot && key->bcolor_slot != ~0)
+ lp_twoside(b, args, key, key->bcolor_slot);
+ else if (vert_attr == key->spec_slot && key->bspec_slot != ~0)
+ lp_twoside(b, args, key, key->bspec_slot);
}
}
}
}
@@
-746,9
+750,11
@@
lp_make_setup_variant_key(struct llvmpipe_context *lp,
key->pixel_center_half = lp->rasterizer->gl_rasterization_rules;
key->twoside = lp->rasterizer->light_twoside;
key->size = Offset(struct lp_setup_variant_key,
key->pixel_center_half = lp->rasterizer->gl_rasterization_rules;
key->twoside = lp->rasterizer->light_twoside;
key->size = Offset(struct lp_setup_variant_key,
- inputs[key->num_inputs]);
- key->color_slot = lp->color_slot;
- key->bcolor_slot = lp->bcolor_slot;
+ inputs[key->num_inputs]);
+ key->color_slot = lp->color_slot[0];
+ key->bcolor_slot = lp->bcolor_slot[0];
+ key->spec_slot = lp->color_slot[1];
+ key->bspec_slot = lp->bcolor_slot[1];
key->units = (float) (lp->rasterizer->offset_units * lp->mrd);
key->scale = lp->rasterizer->offset_scale;
key->pad = 0;
key->units = (float) (lp->rasterizer->offset_units * lp->mrd);
key->scale = lp->rasterizer->offset_scale;
key->pad = 0;
diff --git
a/src/gallium/drivers/llvmpipe/lp_state_setup.h
b/src/gallium/drivers/llvmpipe/lp_state_setup.h
index 40fb8ef4282f78ec3b155db98f27a2100f7b418c..90c55ca4ce654a48a25c58c0e8441173602ffd6d 100644
(file)
--- a/
src/gallium/drivers/llvmpipe/lp_state_setup.h
+++ b/
src/gallium/drivers/llvmpipe/lp_state_setup.h
@@
-15,14
+15,18
@@
struct lp_setup_variant_list_item
struct lp_setup_variant_key {
struct lp_setup_variant_key {
+ unsigned size:16;
unsigned num_inputs:8;
unsigned num_inputs:8;
+ unsigned color_slot:8;
+
+ unsigned bcolor_slot:8;
+ unsigned spec_slot:8;
+ unsigned bspec_slot:8;
unsigned flatshade_first:1;
unsigned pixel_center_half:1;
unsigned twoside:1;
unsigned flatshade_first:1;
unsigned pixel_center_half:1;
unsigned twoside:1;
- unsigned color_slot:8;
- unsigned bcolor_slot:8;
- unsigned size:16;
- unsigned pad:21;
+ unsigned pad:5;
+
float units;
float scale;
struct lp_shader_input inputs[PIPE_MAX_SHADER_INPUTS];
float units;
float scale;
struct lp_shader_input inputs[PIPE_MAX_SHADER_INPUTS];