Rev 4358 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4358 | Rev 4401 | ||
---|---|---|---|
Line 2226... | Line 2226... | ||
2226 | color.sechalf = false; |
2226 | color.sechalf = false; |
2227 | } |
2227 | } |
2228 | } |
2228 | } |
2229 | } |
2229 | } |
Line -... | Line 2230... | ||
- | 2230 | ||
- | 2231 | static int |
|
- | 2232 | cond_for_alpha_func(GLenum func) |
|
- | 2233 | { |
|
- | 2234 | switch(func) { |
|
- | 2235 | case GL_GREATER: |
|
- | 2236 | return BRW_CONDITIONAL_G; |
|
- | 2237 | case GL_GEQUAL: |
|
- | 2238 | return BRW_CONDITIONAL_GE; |
|
- | 2239 | case GL_LESS: |
|
- | 2240 | return BRW_CONDITIONAL_L; |
|
- | 2241 | case GL_LEQUAL: |
|
- | 2242 | return BRW_CONDITIONAL_LE; |
|
- | 2243 | case GL_EQUAL: |
|
- | 2244 | return BRW_CONDITIONAL_EQ; |
|
- | 2245 | case GL_NOTEQUAL: |
|
- | 2246 | return BRW_CONDITIONAL_NEQ; |
|
- | 2247 | default: |
|
- | 2248 | assert(!"Not reached"); |
|
- | 2249 | return 0; |
|
- | 2250 | } |
|
- | 2251 | } |
|
- | 2252 | ||
- | 2253 | /** |
|
- | 2254 | * Alpha test support for when we compile it into the shader instead |
|
- | 2255 | * of using the normal fixed-function alpha test. |
|
- | 2256 | */ |
|
- | 2257 | void |
|
- | 2258 | fs_visitor::emit_alpha_test() |
|
- | 2259 | { |
|
- | 2260 | this->current_annotation = "Alpha test"; |
|
- | 2261 | ||
- | 2262 | fs_inst *cmp; |
|
- | 2263 | if (c->key.alpha_test_func == GL_ALWAYS) |
|
- | 2264 | return; |
|
- | 2265 | ||
- | 2266 | if (c->key.alpha_test_func == GL_NEVER) { |
|
- | 2267 | /* f0.1 = 0 */ |
|
- | 2268 | fs_reg some_reg = fs_reg(retype(brw_vec8_grf(0, 0), |
|
- | 2269 | BRW_REGISTER_TYPE_UW)); |
|
- | 2270 | cmp = emit(CMP(reg_null_f, some_reg, some_reg, |
|
- | 2271 | BRW_CONDITIONAL_NEQ)); |
|
- | 2272 | } else { |
|
- | 2273 | /* RT0 alpha */ |
|
- | 2274 | fs_reg color = outputs[0]; |
|
- | 2275 | color.reg_offset += 3; |
|
- | 2276 | ||
- | 2277 | /* f0.1 &= func(color, ref) */ |
|
- | 2278 | cmp = emit(CMP(reg_null_f, color, fs_reg(c->key.alpha_test_ref), |
|
- | 2279 | cond_for_alpha_func(c->key.alpha_test_func))); |
|
- | 2280 | } |
|
- | 2281 | cmp->predicate = BRW_PREDICATE_NORMAL; |
|
- | 2282 | cmp->flag_subreg = 1; |
|
- | 2283 | } |
|
2230 | 2284 | ||
2231 | void |
2285 | void |
2232 | fs_visitor::emit_fb_writes() |
2286 | fs_visitor::emit_fb_writes() |
2233 | { |
2287 | { |
2234 | this->current_annotation = "FB write header"; |
2288 | this->current_annotation = "FB write header"; |