Changeset 54765 in vbox for trunk/src/VBox/Devices/Graphics/shaderlib/glsl_shader.c
- Timestamp:
- Mar 15, 2015 5:15:57 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/shaderlib/glsl_shader.c
r53740 r54765 1318 1318 shader_addline(buffer, "vec4 tmp0;\n"); 1319 1319 shader_addline(buffer, "vec4 tmp1;\n"); 1320 #ifdef VBOX_WITH_VMSVGA 1321 shader_addline(buffer, "bool p0[4];\n"); 1322 #endif 1320 1323 1321 1324 /* Local constants use a different name so they can be loaded once at shader link time … … 1630 1633 break; 1631 1634 1635 #ifdef VBOX_WITH_VMSVGA 1636 case WINED3DSPR_PREDICATE: 1637 sprintf(register_name, "p0"); 1638 break; 1639 #endif 1640 1632 1641 default: 1633 1642 FIXME("Unhandled register name Type(%d)\n", reg->type); … … 1659 1668 else 1660 1669 { 1670 #ifdef VBOX_WITH_VMSVGA 1671 if (param->reg.type == WINED3DSPR_PREDICATE) 1672 { 1673 *write_mask++ = '['; 1674 if (mask & WINED3DSP_WRITEMASK_0) *write_mask++ = '0'; 1675 else 1676 if (mask & WINED3DSP_WRITEMASK_1) *write_mask++ = '1'; 1677 else 1678 if (mask & WINED3DSP_WRITEMASK_2) *write_mask++ = '2'; 1679 else 1680 if (mask & WINED3DSP_WRITEMASK_3) *write_mask++ = '3'; 1681 *write_mask++ = ']'; 1682 *write_mask = '\0'; 1683 } 1684 else 1685 #endif 1661 1686 shader_glsl_write_mask_to_str(mask, write_mask); 1662 1687 } … … 2161 2186 } 2162 2187 2188 #ifdef VBOX_WITH_VMSVGA 2189 static void shader_glsl_mov_impl(const struct wined3d_shader_instruction *ins, int p0_idx); 2190 2163 2191 /* Process the WINED3DSIO_MOV opcode using GLSL (dst = src) */ 2164 2192 static void shader_glsl_mov(const struct wined3d_shader_instruction *ins) 2193 { 2194 if (ins->predicate) 2195 { 2196 int i; 2197 DWORD dst_mask = ins->dst[0].write_mask; 2198 struct wined3d_shader_dst_param *dst = (struct wined3d_shader_dst_param *)&ins->dst[0]; 2199 2200 for (i = 0; i < 4; i++) 2201 { 2202 if (dst_mask & RT_BIT(i)) 2203 { 2204 dst->write_mask = RT_BIT(i); 2205 2206 shader_glsl_mov_impl(ins, i); 2207 } 2208 } 2209 dst->write_mask = dst_mask; 2210 } 2211 else 2212 shader_glsl_mov_impl(ins, 0); 2213 } 2214 2215 /* Process the WINED3DSIO_MOV opcode using GLSL (dst = src) */ 2216 static void shader_glsl_mov_impl(const struct wined3d_shader_instruction *ins, int p0_idx) 2217 2218 #else 2219 /* Process the WINED3DSIO_MOV opcode using GLSL (dst = src) */ 2220 static void shader_glsl_mov(const struct wined3d_shader_instruction *ins) 2221 #endif 2165 2222 { 2166 2223 const struct wined3d_gl_info *gl_info = ins->ctx->gl_info; … … 2168 2225 glsl_src_param_t src0_param; 2169 2226 DWORD write_mask; 2227 2228 #ifdef VBOX_WITH_VMSVGA 2229 if (ins->predicate) 2230 { 2231 shader_addline(buffer, "if (p0[%d]) {\n", p0_idx); 2232 } 2233 #endif 2170 2234 2171 2235 write_mask = shader_glsl_append_dst(buffer, ins); … … 2212 2276 shader_addline(buffer, "%s);\n", src0_param.param_str); 2213 2277 } 2278 #ifdef VBOX_WITH_VMSVGA 2279 if (ins->predicate) 2280 { 2281 shader_addline(buffer, "}\n"); 2282 } 2283 #endif 2214 2284 } 2215 2285 … … 2468 2538 } 2469 2539 } 2540 2541 #ifdef VBOX_WITH_VMSVGA 2542 static void shader_glsl_setp(const struct wined3d_shader_instruction *ins) 2543 { 2544 struct wined3d_shader_buffer *buffer = ins->ctx->buffer; 2545 glsl_src_param_t src_param1, src_param2; 2546 DWORD write_mask; 2547 2548 int i; 2549 DWORD dst_mask = ins->dst[0].write_mask; 2550 struct wined3d_shader_dst_param dst = ins->dst[0]; 2551 2552 /* Cycle through all source0 channels */ 2553 for (i=0; i<4; i++) { 2554 if (dst_mask & RT_BIT(i)) 2555 { 2556 write_mask = WINED3DSP_WRITEMASK_0 << i; 2557 dst.write_mask = dst_mask & write_mask; 2558 2559 write_mask = shader_glsl_append_dst_ext(ins->ctx->buffer, ins, &dst); 2560 Assert(write_mask); 2561 2562 shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src_param1); 2563 shader_glsl_add_src_param(ins, &ins->src[1], write_mask, &src_param2); 2564 2565 shader_addline(buffer, "%s %s %s);\n", 2566 src_param1.param_str, shader_get_comp_op(ins->flags), src_param2.param_str); 2567 } 2568 } 2569 } 2570 #endif 2470 2571 2471 2572 /** Process signed comparison opcodes in GLSL. */ … … 5314 5415 /* WINED3DSIH_RET */ shader_glsl_ret, 5315 5416 /* WINED3DSIH_RSQ */ shader_glsl_rsq, 5417 #ifdef VBOX_WITH_VMSVGA 5418 /* WINED3DSIH_SETP */ shader_glsl_setp, 5419 #else 5316 5420 /* WINED3DSIH_SETP */ NULL, 5421 #endif 5317 5422 /* WINED3DSIH_SGE */ shader_glsl_compare, 5318 5423 /* WINED3DSIH_SGN */ shader_glsl_sgn,
Note:
See TracChangeset
for help on using the changeset viewer.