Changeset 79670 in vbox for trunk/src/VBox/Devices/Graphics/shaderlib
- Timestamp:
- Jul 10, 2019 11:12:57 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/shaderlib/shader.c
r69046 r79670 500 500 { 501 501 struct wined3d_shader_semantic semantic; 502 unsigned int reg_idx; 502 503 503 504 fe->shader_read_semantic(&ptr, &semantic); 505 reg_idx = semantic.reg.reg.idx; 504 506 505 507 switch (semantic.reg.reg.type) … … 507 509 /* Mark input registers used. */ 508 510 case WINED3DSPR_INPUT: 509 reg_maps->input_registers |= 1 << semantic.reg.reg.idx; 510 shader_signature_from_semantic(&input_signature[semantic.reg.reg.idx], &semantic); 511 if (reg_idx >= MAX_REG_INPUT) 512 { 513 ERR("Invalid input register index %d.\n", reg_idx); 514 return E_INVALIDARG; 515 } 516 reg_maps->input_registers |= 1 << reg_idx; 517 shader_signature_from_semantic(&input_signature[reg_idx], &semantic); 511 518 break; 512 519 513 520 /* Vertex shader: mark 3.0 output registers used, save token. */ 514 521 case WINED3DSPR_OUTPUT: 515 reg_maps->output_registers |= 1 << semantic.reg.reg.idx; 516 shader_signature_from_semantic(&output_signature[semantic.reg.reg.idx], &semantic); 522 if (reg_idx >= MAX_REG_OUTPUT) 523 { 524 ERR("Invalid output register index %d.\n", reg_idx); 525 return E_INVALIDARG; 526 } 527 reg_maps->output_registers |= 1 << reg_idx; 528 shader_signature_from_semantic(&output_signature[reg_idx], &semantic); 517 529 if (semantic.usage == WINED3DDECLUSAGE_FOG) reg_maps->fog = 1; 518 530 break; … … 520 532 /* Save sampler usage token. */ 521 533 case WINED3DSPR_SAMPLER: 522 reg_maps->sampler_type[semantic.reg.reg.idx] = semantic.sampler_type; 534 if (reg_idx >= RT_ELEMENTS(reg_maps->sampler_type)) 535 { 536 ERR("Invalid sampler index %d.\n", reg_idx); 537 return E_INVALIDARG; 538 } 539 reg_maps->sampler_type[reg_idx] = semantic.sampler_type; 523 540 break; 524 541 … … 654 671 && dst_param.reg.type == WINED3DSPR_TEXCRDOUT) 655 672 { 656 reg_maps->texcoord_mask[dst_param.reg.idx] |= dst_param.write_mask; 673 unsigned int idx = dst_param.reg.idx; 674 675 if (idx >= MAX_REG_TEXCRD) 676 { 677 ERR("Invalid texcoord index %d.\n", idx); 678 return E_INVALIDARG; 679 } 680 681 reg_maps->texcoord_mask[idx] |= dst_param.write_mask; 657 682 } 658 683 … … 703 728 /* Fake sampler usage, only set reserved bit and type. */ 704 729 DWORD sampler_code = dst_param.reg.idx; 730 731 if (sampler_code >= RT_ELEMENTS(reg_maps->sampler_type)) 732 { 733 ERR("Invalid sampler index %d.\n", sampler_code); 734 return E_INVALIDARG; 735 } 705 736 706 737 TRACE("Setting fake 2D sampler for 1.x pixelshader.\n");
Note:
See TracChangeset
for help on using the changeset viewer.