trunk/src/osd/windows/d3dhlsl.c
r19912 | r19913 | |
197 | 197 | prescale_force_y = 0; |
198 | 198 | preset = -1; |
199 | 199 | shadow_texture = NULL; |
200 | | registered_targets = 0; |
201 | | cyclic_target_idx = 0; |
202 | 200 | options = NULL; |
203 | 201 | paused = true; |
204 | 202 | lastidx = -1; |
| 203 | targethead = NULL; |
| 204 | cachehead = NULL; |
205 | 205 | } |
206 | 206 | |
207 | 207 | |
r19912 | r19913 | |
292 | 292 | HRESULT result = (*d3dintf->device.get_render_target_data)(d3d->device, surface, avi_copy_surface); |
293 | 293 | if (result != D3D_OK) |
294 | 294 | { |
295 | | printf("Couldn't copy (%08x)\n", (UINT32)result); |
296 | 295 | return; |
297 | 296 | } |
298 | 297 | |
r19912 | r19913 | |
300 | 299 | result = (*d3dintf->surface.lock_rect)(avi_copy_surface, &rect, NULL, D3DLOCK_DISCARD); |
301 | 300 | if (result != D3D_OK) |
302 | 301 | { |
303 | | printf("Couldn't lock (%08x)\n", (UINT32)result); |
304 | 302 | return; |
305 | 303 | } |
306 | 304 | |
r19912 | r19913 | |
346 | 344 | HRESULT result = (*d3dintf->device.get_render_target_data)(d3d->device, surface, snap_copy_target); |
347 | 345 | if (result != D3D_OK) |
348 | 346 | { |
349 | | printf("Couldn't copy (%08x)\n", (UINT32)result); |
350 | 347 | return; |
351 | 348 | } |
352 | 349 | |
r19912 | r19913 | |
354 | 351 | result = (*d3dintf->surface.lock_rect)(snap_copy_target, &rect, NULL, D3DLOCK_DISCARD); |
355 | 352 | if (result != D3D_OK) |
356 | 353 | { |
357 | | printf("Couldn't lock (%08x)\n", (UINT32)result); |
358 | 354 | return; |
359 | 355 | } |
360 | 356 | |
r19912 | r19913 | |
575 | 571 | |
576 | 572 | |
577 | 573 | //============================================================ |
| 574 | // remove_render_target - remove an active cache target when |
| 575 | // refcount hits zero |
| 576 | //============================================================ |
| 577 | |
| 578 | void hlsl_info::remove_cache_target(d3d_cache_target *cache) |
| 579 | { |
| 580 | if (cache != NULL) |
| 581 | { |
| 582 | if (cache == cachehead) |
| 583 | { |
| 584 | cachehead= cachehead->next; |
| 585 | } |
| 586 | |
| 587 | if (cache->prev != NULL) |
| 588 | { |
| 589 | cache->prev->next = cache->next; |
| 590 | } |
| 591 | |
| 592 | if (cache->next != NULL) |
| 593 | { |
| 594 | cache->next->prev = cache->prev; |
| 595 | } |
| 596 | |
| 597 | global_free(cache); |
| 598 | } |
| 599 | } |
| 600 | |
| 601 | |
| 602 | //============================================================ |
| 603 | // remove_render_target - remove an active target |
| 604 | //============================================================ |
| 605 | |
| 606 | void hlsl_info::remove_render_target(d3d_texture_info *texture) |
| 607 | { |
| 608 | d3d_render_target *rt = find_render_target(texture); |
| 609 | |
| 610 | if (rt != NULL) |
| 611 | { |
| 612 | if (rt == targethead) |
| 613 | { |
| 614 | targethead = targethead->next; |
| 615 | } |
| 616 | |
| 617 | if (rt->prev != NULL) |
| 618 | { |
| 619 | rt->prev->next = rt->next; |
| 620 | } |
| 621 | |
| 622 | if (rt->next != NULL) |
| 623 | { |
| 624 | rt->next->prev = rt->prev; |
| 625 | } |
| 626 | |
| 627 | d3d_cache_target *cache = find_cache_target(rt->screen_index); |
| 628 | if (cache != NULL) |
| 629 | { |
| 630 | cache->ref_count--; |
| 631 | if (cache->ref_count == 0) |
| 632 | { |
| 633 | remove_cache_target(cache); |
| 634 | } |
| 635 | } |
| 636 | global_free(rt); |
| 637 | } |
| 638 | } |
| 639 | |
| 640 | //============================================================ |
578 | 641 | // hlsl_info::set_texture |
579 | 642 | //============================================================ |
580 | 643 | |
r19912 | r19913 | |
589 | 652 | { |
590 | 653 | if(texture->prev_frame == texture->cur_frame) |
591 | 654 | { |
592 | | //printf("Paused\n"); |
593 | 655 | paused = true; |
594 | 656 | } |
595 | 657 | else |
596 | 658 | { |
597 | | //printf("Not paused\n"); |
598 | 659 | paused = false; |
599 | 660 | } |
600 | 661 | |
601 | 662 | texture->prev_frame = texture->cur_frame; |
602 | | //printf("%08x cur_frame is %d\n", (UINT32)(UINT64)texture, texture->cur_frame); |
603 | 663 | } |
604 | 664 | |
605 | 665 | (*d3dintf->effect.set_texture)(effect, "Diffuse", (texture == NULL) ? d3d->default_texture->d3dfinaltex : texture->d3dfinaltex); |
r19912 | r19913 | |
627 | 687 | prescale_size_x = 1; |
628 | 688 | prescale_size_y = 1; |
629 | 689 | preset = downcast<windows_options &>(window->machine().options()).d3d_hlsl_preset(); |
| 690 | if (preset < -1 || preset > 3) |
| 691 | { |
| 692 | preset = -1; |
| 693 | } |
630 | 694 | |
631 | 695 | snap_width = downcast<windows_options &>(window->machine().options()).d3d_snap_width(); |
632 | 696 | snap_height = downcast<windows_options &>(window->machine().options()).d3d_snap_height(); |
r19912 | r19913 | |
1022 | 1086 | result = (*d3dintf->device.create_effect)(d3d->device, primary_name, &effect); |
1023 | 1087 | if(result != D3D_OK) |
1024 | 1088 | { |
1025 | | printf("Direct3D: Unable to load primary.fx\n"); |
| 1089 | mame_printf_verbose("Direct3D: Unable to load primary.fx\n"); |
1026 | 1090 | return 1; |
1027 | 1091 | } |
1028 | 1092 | |
r19912 | r19913 | |
1030 | 1094 | result = (*d3dintf->device.create_effect)(d3d->device, post_name, &post_effect); |
1031 | 1095 | if(result != D3D_OK) |
1032 | 1096 | { |
1033 | | printf("Direct3D: Unable to load post.fx\n"); |
| 1097 | mame_printf_verbose("Direct3D: Unable to load post.fx\n"); |
1034 | 1098 | return 1; |
1035 | 1099 | } |
1036 | 1100 | |
r19912 | r19913 | |
1038 | 1102 | result = (*d3dintf->device.create_effect)(d3d->device, prescale_name, &prescale_effect); |
1039 | 1103 | if(result != D3D_OK) |
1040 | 1104 | { |
1041 | | printf("Direct3D: Unable to load prescale.fx\n"); |
| 1105 | mame_printf_verbose("Direct3D: Unable to load prescale.fx\n"); |
1042 | 1106 | return 1; |
1043 | 1107 | } |
1044 | 1108 | |
r19912 | r19913 | |
1046 | 1110 | result = (*d3dintf->device.create_effect)(d3d->device, pincushion_name, &pincushion_effect); |
1047 | 1111 | if(result != D3D_OK) |
1048 | 1112 | { |
1049 | | printf("Direct3D: Unable to load pincushion.fx\n"); |
| 1113 | mame_printf_verbose("Direct3D: Unable to load pincushion.fx\n"); |
1050 | 1114 | return 1; |
1051 | 1115 | } |
1052 | 1116 | |
r19912 | r19913 | |
1054 | 1118 | result = (*d3dintf->device.create_effect)(d3d->device, phosphor_name, &phosphor_effect); |
1055 | 1119 | if(result != D3D_OK) |
1056 | 1120 | { |
1057 | | printf("Direct3D: Unable to load phosphor.fx\n"); |
| 1121 | mame_printf_verbose("Direct3D: Unable to load phosphor.fx\n"); |
1058 | 1122 | return 1; |
1059 | 1123 | } |
1060 | 1124 | |
r19912 | r19913 | |
1062 | 1126 | result = (*d3dintf->device.create_effect)(d3d->device, focus_name, &focus_effect); |
1063 | 1127 | if(result != D3D_OK) |
1064 | 1128 | { |
1065 | | printf("Direct3D: Unable to load focus.fx\n"); |
| 1129 | mame_printf_verbose("Direct3D: Unable to load focus.fx\n"); |
1066 | 1130 | return 1; |
1067 | 1131 | } |
1068 | 1132 | |
r19912 | r19913 | |
1070 | 1134 | result = (*d3dintf->device.create_effect)(d3d->device, deconverge_name, &deconverge_effect); |
1071 | 1135 | if(result != D3D_OK) |
1072 | 1136 | { |
1073 | | printf("Direct3D: Unable to load deconverge.fx\n"); |
| 1137 | mame_printf_verbose("Direct3D: Unable to load deconverge.fx\n"); |
1074 | 1138 | return 1; |
1075 | 1139 | } |
1076 | 1140 | |
r19912 | r19913 | |
1078 | 1142 | result = (*d3dintf->device.create_effect)(d3d->device, color_name, &color_effect); |
1079 | 1143 | if(result != D3D_OK) |
1080 | 1144 | { |
1081 | | printf("Direct3D: Unable to load color.fx\n"); |
| 1145 | mame_printf_verbose("Direct3D: Unable to load color.fx\n"); |
1082 | 1146 | return 1; |
1083 | 1147 | } |
1084 | 1148 | |
r19912 | r19913 | |
1086 | 1150 | result = (*d3dintf->device.create_effect)(d3d->device, yiq_encode_name, &yiq_encode_effect); |
1087 | 1151 | if(result != D3D_OK) |
1088 | 1152 | { |
1089 | | printf("Direct3D: Unable to load yiq_encode.fx\n"); |
| 1153 | mame_printf_verbose("Direct3D: Unable to load yiq_encode.fx\n"); |
1090 | 1154 | return 1; |
1091 | 1155 | } |
1092 | 1156 | |
r19912 | r19913 | |
1094 | 1158 | result = (*d3dintf->device.create_effect)(d3d->device, yiq_decode_name, &yiq_decode_effect); |
1095 | 1159 | if(result != D3D_OK) |
1096 | 1160 | { |
1097 | | printf("Direct3D: Unable to load yiq_decode.fx\n"); |
| 1161 | mame_printf_verbose("Direct3D: Unable to load yiq_decode.fx\n"); |
1098 | 1162 | return 1; |
1099 | 1163 | } |
1100 | 1164 | |
r19912 | r19913 | |
1148 | 1212 | |
1149 | 1213 | HRESULT result = (*d3dintf->device.get_render_target)(d3d->device, 0, &backbuffer); |
1150 | 1214 | if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device get_render_target call\n", (int)result); |
1151 | | |
1152 | | for (int index = 0; index < 9; index++) |
1153 | | screen_encountered[index] = false; |
1154 | 1215 | } |
1155 | 1216 | |
1156 | 1217 | |
r19912 | r19913 | |
1219 | 1280 | |
1220 | 1281 | |
1221 | 1282 | //============================================================ |
| 1283 | // hlsl_info::find_render_target |
| 1284 | //============================================================ |
| 1285 | |
| 1286 | d3d_render_target* hlsl_info::find_render_target(d3d_texture_info *info) |
| 1287 | { |
| 1288 | d3d_render_target *curr = targethead; |
| 1289 | |
| 1290 | while (curr != NULL && curr->info != info) |
| 1291 | { |
| 1292 | curr = curr->next; |
| 1293 | } |
| 1294 | |
| 1295 | return curr; |
| 1296 | } |
| 1297 | |
| 1298 | |
| 1299 | //============================================================ |
| 1300 | // hlsl_info::find_cache_target |
| 1301 | //============================================================ |
| 1302 | |
| 1303 | d3d_cache_target* hlsl_info::find_cache_target(int screen_index) |
| 1304 | { |
| 1305 | d3d_cache_target *curr = cachehead; |
| 1306 | |
| 1307 | while (curr != NULL && curr->screen_index != screen_index) |
| 1308 | { |
| 1309 | curr = curr->next; |
| 1310 | } |
| 1311 | |
| 1312 | return curr; |
| 1313 | } |
| 1314 | |
| 1315 | |
| 1316 | //============================================================ |
1222 | 1317 | // hlsl_info::render_quad |
1223 | 1318 | //============================================================ |
1224 | 1319 | |
r19912 | r19913 | |
1232 | 1327 | |
1233 | 1328 | if(PRIMFLAG_GET_SCREENTEX(d3d->last_texture_flags) && poly->texture != NULL) |
1234 | 1329 | { |
1235 | | int rawidx = poly->texture->target_index; |
1236 | | int targetidx = rawidx % 9; |
1237 | | int minidx = cyclic_target_idx - (num_screens * 2); |
1238 | | int wrappedidx = (minidx + ((rawidx - minidx) % num_screens) + num_screens) % 9; |
1239 | | //printf("rendering %d %d %d %d %d %d %d %d %d %f %f\n", poly->texture->target_index, rawidx, targetidx, minidx, wrappedidx, poly->texture->rawwidth, poly->texture->rawheight, d3d->width, d3d->height, (float)(poly->texture->ustop - poly->texture->ustart), (float)(poly->texture->vstop - poly->texture->vstart)); |
| 1330 | d3d_render_target *rt = find_render_target(poly->texture); |
| 1331 | if (rt == NULL) |
| 1332 | { |
| 1333 | return; |
| 1334 | } |
| 1335 | d3d_cache_target *ct = find_cache_target(rt->screen_index); |
1240 | 1336 | |
1241 | | screen_encountered[targetidx] = true; |
1242 | | target_in_use[targetidx] = poly->texture; |
1243 | | |
1244 | | target_use_count[targetidx] = 60; |
1245 | | |
1246 | 1337 | if(options->yiq_enable) |
1247 | 1338 | { |
1248 | 1339 | /* Convert our signal into YIQ */ |
r19912 | r19913 | |
1267 | 1358 | (*d3dintf->effect.set_float)(curr_effect, "ScanTime", options->yiq_scan_time); |
1268 | 1359 | } |
1269 | 1360 | |
1270 | | HRESULT result = (*d3dintf->device.set_render_target)(d3d->device, 0, target4[targetidx]); |
| 1361 | HRESULT result = (*d3dintf->device.set_render_target)(d3d->device, 0, rt->target[4]); |
1271 | 1362 | |
1272 | 1363 | if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result); |
1273 | 1364 | result = (*d3dintf->device.clear)(d3d->device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0); |
r19912 | r19913 | |
1289 | 1380 | /* Convert our signal from YIQ */ |
1290 | 1381 | curr_effect = yiq_decode_effect; |
1291 | 1382 | |
1292 | | (*d3dintf->effect.set_texture)(curr_effect, "Composite", texture4[targetidx]); |
| 1383 | (*d3dintf->effect.set_texture)(curr_effect, "Composite", rt->texture[4]); |
1293 | 1384 | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", poly->texture->d3dfinaltex); |
1294 | 1385 | if(options->params_dirty) |
1295 | 1386 | { |
r19912 | r19913 | |
1311 | 1402 | (*d3dintf->effect.set_float)(curr_effect, "ScanTime", options->yiq_scan_time); |
1312 | 1403 | } |
1313 | 1404 | |
1314 | | result = (*d3dintf->device.set_render_target)(d3d->device, 0, target3[targetidx]); |
| 1405 | result = (*d3dintf->device.set_render_target)(d3d->device, 0, rt->target[3]); |
1315 | 1406 | |
1316 | 1407 | if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result); |
1317 | 1408 | result = (*d3dintf->device.clear)(d3d->device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0); |
r19912 | r19913 | |
1332 | 1423 | |
1333 | 1424 | curr_effect = color_effect; |
1334 | 1425 | |
1335 | | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", texture3[targetidx]); |
| 1426 | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", rt->texture[3]); |
1336 | 1427 | } |
1337 | 1428 | |
1338 | 1429 | curr_effect = color_effect; |
r19912 | r19913 | |
1355 | 1446 | (*d3dintf->effect.set_float)(curr_effect, "Saturation", options->saturation); |
1356 | 1447 | } |
1357 | 1448 | |
1358 | | HRESULT result = (*d3dintf->device.set_render_target)(d3d->device, 0, smalltarget0[targetidx]); |
| 1449 | HRESULT result = (*d3dintf->device.set_render_target)(d3d->device, 0, rt->smalltarget); |
1359 | 1450 | |
1360 | 1451 | if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result); |
1361 | 1452 | result = (*d3dintf->device.clear)(d3d->device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0); |
r19912 | r19913 | |
1376 | 1467 | |
1377 | 1468 | /* Pre-scaling pass */ |
1378 | 1469 | curr_effect = prescale_effect; |
1379 | | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", smalltexture0[targetidx]); |
| 1470 | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", rt->smalltexture); |
1380 | 1471 | |
1381 | 1472 | if(options->params_dirty) |
1382 | 1473 | { |
r19912 | r19913 | |
1390 | 1481 | |
1391 | 1482 | (*d3dintf->effect.begin)(curr_effect, &num_passes, 0); |
1392 | 1483 | |
1393 | | result = (*d3dintf->device.set_render_target)(d3d->device, 0, prescaletarget0[targetidx]); |
| 1484 | result = (*d3dintf->device.set_render_target)(d3d->device, 0, rt->prescaletarget); |
1394 | 1485 | if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result); |
1395 | 1486 | result = (*d3dintf->device.clear)(d3d->device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0); |
1396 | 1487 | if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device clear call\n", (int)result); |
r19912 | r19913 | |
1408 | 1499 | |
1409 | 1500 | /* Deconverge pass */ |
1410 | 1501 | curr_effect = deconverge_effect; |
1411 | | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", prescaletexture0[targetidx]); |
| 1502 | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", rt->prescaletexture); |
1412 | 1503 | |
1413 | 1504 | if(options->params_dirty) |
1414 | 1505 | { |
r19912 | r19913 | |
1426 | 1517 | |
1427 | 1518 | (*d3dintf->effect.begin)(curr_effect, &num_passes, 0); |
1428 | 1519 | |
1429 | | result = (*d3dintf->device.set_render_target)(d3d->device, 0, target2[targetidx]); |
| 1520 | result = (*d3dintf->device.set_render_target)(d3d->device, 0, rt->target[2]); |
1430 | 1521 | if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call 6\n", (int)result); |
1431 | 1522 | result = (*d3dintf->device.clear)(d3d->device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0); |
1432 | 1523 | if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device clear call\n", (int)result); |
r19912 | r19913 | |
1450 | 1541 | /* Defocus pass 1 */ |
1451 | 1542 | curr_effect = focus_effect; |
1452 | 1543 | |
1453 | | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", texture2[targetidx]); |
| 1544 | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", rt->texture[2]); |
1454 | 1545 | |
1455 | 1546 | (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width); |
1456 | 1547 | (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height); |
r19912 | r19913 | |
1463 | 1554 | |
1464 | 1555 | (*d3dintf->effect.begin)(curr_effect, &num_passes, 0); |
1465 | 1556 | |
1466 | | result = (*d3dintf->device.set_render_target)(d3d->device, 0, target0[targetidx]); |
| 1557 | result = (*d3dintf->device.set_render_target)(d3d->device, 0, rt->target[0]); |
1467 | 1558 | if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call 6\n", (int)result); |
1468 | 1559 | result = (*d3dintf->device.clear)(d3d->device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0); |
1469 | 1560 | if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device clear call\n", (int)result); |
r19912 | r19913 | |
1481 | 1572 | |
1482 | 1573 | /* Defocus pass 2 */ |
1483 | 1574 | |
1484 | | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", texture0[targetidx]); |
| 1575 | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", rt->texture[0]); |
1485 | 1576 | |
1486 | 1577 | (*d3dintf->effect.set_float)(curr_effect, "TargetWidth", (float)d3d->width); |
1487 | 1578 | (*d3dintf->effect.set_float)(curr_effect, "TargetHeight", (float)d3d->height); |
r19912 | r19913 | |
1494 | 1585 | |
1495 | 1586 | (*d3dintf->effect.begin)(curr_effect, &num_passes, 0); |
1496 | 1587 | |
1497 | | result = (*d3dintf->device.set_render_target)(d3d->device, 0, target1[targetidx]); |
| 1588 | result = (*d3dintf->device.set_render_target)(d3d->device, 0, rt->target[1]); |
1498 | 1589 | if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call 7\n", (int)result); |
1499 | 1590 | |
1500 | 1591 | for (UINT pass = 0; pass < num_passes; pass++) |
r19912 | r19913 | |
1513 | 1604 | // the phosphors are a direct result of the incoming texture, might as well just change the |
1514 | 1605 | // input texture. |
1515 | 1606 | curr_effect = phosphor_effect; |
1516 | | //printf("num_screens %d\n", num_screens); |
1517 | 1607 | |
1518 | 1608 | if(options->params_dirty) |
1519 | 1609 | { |
r19912 | r19913 | |
1525 | 1615 | (*d3dintf->effect.set_float)(curr_effect, "HeightRatio", 1.0f / (poly->texture->vstop - poly->texture->vstart)); |
1526 | 1616 | (*d3dintf->effect.set_vector)(curr_effect, "Phosphor", 3, options->phosphor); |
1527 | 1617 | } |
1528 | | (*d3dintf->effect.set_float)(curr_effect, "TextureWidth", (float)target_width[targetidx]); |
1529 | | (*d3dintf->effect.set_float)(curr_effect, "TextureHeight", (float)target_height[targetidx]); |
| 1618 | (*d3dintf->effect.set_float)(curr_effect, "TextureWidth", (float)rt->target_width); |
| 1619 | (*d3dintf->effect.set_float)(curr_effect, "TextureHeight", (float)rt->target_height); |
1530 | 1620 | (*d3dintf->effect.set_float)(curr_effect, "Passthrough", 0.0f); |
1531 | 1621 | |
1532 | | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", focus_enable ? texture1[targetidx] : texture2[targetidx]); |
1533 | | (*d3dintf->effect.set_texture)(curr_effect, "LastPass", last_texture[wrappedidx]); // Avoid changing targets due to page flipping |
| 1622 | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", focus_enable ? rt->texture[1] : rt->texture[2]); |
| 1623 | (*d3dintf->effect.set_texture)(curr_effect, "LastPass", ct->last_texture); |
1534 | 1624 | |
1535 | | result = (*d3dintf->device.set_render_target)(d3d->device, 0, target0[targetidx]); |
| 1625 | result = (*d3dintf->device.set_render_target)(d3d->device, 0, rt->target[0]); |
1536 | 1626 | if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call 4\n", (int)result); |
1537 | 1627 | result = (*d3dintf->device.clear)(d3d->device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0); |
1538 | 1628 | if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device clear call\n", (int)result); |
r19912 | r19913 | |
1553 | 1643 | /* Pass along our phosphor'd screen */ |
1554 | 1644 | curr_effect = phosphor_effect; |
1555 | 1645 | |
1556 | | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", texture0[targetidx]); |
1557 | | (*d3dintf->effect.set_texture)(curr_effect, "LastPass", texture0[targetidx]); |
| 1646 | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", rt->texture[0]); |
| 1647 | (*d3dintf->effect.set_texture)(curr_effect, "LastPass", rt->texture[0]); |
1558 | 1648 | (*d3dintf->effect.set_float)(curr_effect, "Passthrough", 1.0f); |
1559 | 1649 | |
1560 | | result = (*d3dintf->device.set_render_target)(d3d->device, 0, last_target[wrappedidx]); // Avoid changing targets due to page flipping |
| 1650 | result = (*d3dintf->device.set_render_target)(d3d->device, 0, ct->last_target); // Avoid changing targets due to page flipping |
1561 | 1651 | if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call 5\n", (int)result); |
1562 | 1652 | result = (*d3dintf->device.clear)(d3d->device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0); |
1563 | 1653 | if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device clear call\n", (int)result); |
r19912 | r19913 | |
1580 | 1670 | { |
1581 | 1671 | curr_effect = post_effect; |
1582 | 1672 | |
1583 | | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", texture0[targetidx]); |
| 1673 | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", rt->texture[0]); |
1584 | 1674 | |
1585 | 1675 | result = (*d3dintf->device.set_render_target)(d3d->device, 0, avi_final_target); |
1586 | 1676 | if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result); |
r19912 | r19913 | |
1603 | 1693 | { |
1604 | 1694 | curr_effect = post_effect; |
1605 | 1695 | |
1606 | | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", texture0[targetidx]); |
| 1696 | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", rt->texture[0]); |
1607 | 1697 | |
1608 | 1698 | result = (*d3dintf->device.set_render_target)(d3d->device, 0, snap_target); |
1609 | 1699 | if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result); |
r19912 | r19913 | |
1627 | 1717 | /* Scanlines and shadow mask */ |
1628 | 1718 | curr_effect = post_effect; |
1629 | 1719 | |
1630 | | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", texture0[targetidx]); |
| 1720 | (*d3dintf->effect.set_texture)(curr_effect, "Diffuse", rt->texture[0]); |
1631 | 1721 | |
1632 | 1722 | result = (*d3dintf->device.set_render_target)(d3d->device, 0, backbuffer); |
1633 | 1723 | if (result != D3D_OK) mame_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result); |
r19912 | r19913 | |
1687 | 1777 | if (!master_enable || !d3dintf->post_fx_available) |
1688 | 1778 | return; |
1689 | 1779 | |
1690 | | d3d_info *d3d = (d3d_info *)window->drawdata; |
1691 | | |
1692 | 1780 | (*d3dintf->surface.release)(backbuffer); |
1693 | | |
1694 | | //printf("registered_targets %d\n", registered_targets); |
1695 | | |
1696 | | // Don't check de-registration if we're paused. |
1697 | | if(paused) |
1698 | | { |
1699 | | return; |
1700 | | } |
1701 | | |
1702 | | // Unregister any registered targets we didn't traverse in the past frame. A resolution change must |
1703 | | // have occurred. |
1704 | | for(int index = 0; index < 9; index++) |
1705 | | { |
1706 | | if(!screen_encountered[index] && smalltarget0[index] != NULL) |
1707 | | { |
1708 | | if(target_use_count[index] > 0) |
1709 | | { |
1710 | | target_use_count[index]--; |
1711 | | } |
1712 | | else |
1713 | | { |
1714 | | //printf("deregging %d\n", index); |
1715 | | // free all textures |
1716 | | if(target_in_use[index] != NULL) |
1717 | | { |
1718 | | d3d_texture_info *tex = target_in_use[index]; |
1719 | | bool found_in_active_list = false; |
1720 | | d3d_texture_info *test_tex = d3d->texlist; |
1721 | | while (test_tex != NULL) |
1722 | | { |
1723 | | if(test_tex == tex) |
1724 | | { |
1725 | | found_in_active_list = true; |
1726 | | break; |
1727 | | } |
1728 | | test_tex = test_tex->next; |
1729 | | } |
1730 | | |
1731 | | // only clean up a texture if it won't be cleaned up by drawd3d |
1732 | | if(!found_in_active_list) |
1733 | | { |
1734 | | if (tex->d3dfinaltex != NULL) |
1735 | | { |
1736 | | (*d3dintf->texture.release)(tex->d3dfinaltex); |
1737 | | tex->d3dfinaltex = NULL; |
1738 | | } |
1739 | | if (tex->d3dtex != NULL && tex->d3dtex != tex->d3dfinaltex) |
1740 | | { |
1741 | | (*d3dintf->texture.release)(tex->d3dtex); |
1742 | | tex->d3dtex = NULL; |
1743 | | } |
1744 | | if (tex->d3dsurface != NULL) |
1745 | | { |
1746 | | (*d3dintf->surface.release)(tex->d3dsurface); |
1747 | | } |
1748 | | global_free(tex); |
1749 | | } |
1750 | | } |
1751 | | |
1752 | | if (prescaletexture0[index] != NULL) |
1753 | | { |
1754 | | (*d3dintf->texture.release)(prescaletexture0[index]); |
1755 | | prescaletexture0[index] = NULL; |
1756 | | } |
1757 | | if (texture0[index] != NULL) |
1758 | | { |
1759 | | (*d3dintf->texture.release)(texture0[index]); |
1760 | | texture0[index] = NULL; |
1761 | | } |
1762 | | if (texture1[index] != NULL) |
1763 | | { |
1764 | | (*d3dintf->texture.release)(texture1[index]); |
1765 | | texture1[index] = NULL; |
1766 | | } |
1767 | | if (texture2[index] != NULL) |
1768 | | { |
1769 | | (*d3dintf->texture.release)(texture2[index]); |
1770 | | texture2[index] = NULL; |
1771 | | } |
1772 | | if (texture3[index] != NULL) |
1773 | | { |
1774 | | (*d3dintf->texture.release)(texture3[index]); |
1775 | | texture3[index] = NULL; |
1776 | | } |
1777 | | if (texture4[index] != NULL) |
1778 | | { |
1779 | | (*d3dintf->texture.release)(texture4[index]); |
1780 | | texture4[index] = NULL; |
1781 | | } |
1782 | | if (smalltexture0[index] != NULL) |
1783 | | { |
1784 | | (*d3dintf->texture.release)(smalltexture0[index]); |
1785 | | smalltexture0[index] = NULL; |
1786 | | } |
1787 | | if (prescaletarget0[index] != NULL) |
1788 | | { |
1789 | | (*d3dintf->surface.release)(prescaletarget0[index]); |
1790 | | prescaletarget0[index] = NULL; |
1791 | | } |
1792 | | if (target0[index] != NULL) |
1793 | | { |
1794 | | (*d3dintf->surface.release)(target0[index]); |
1795 | | target0[index] = NULL; |
1796 | | } |
1797 | | if (target1[index] != NULL) |
1798 | | { |
1799 | | (*d3dintf->surface.release)(target1[index]); |
1800 | | target1[index] = NULL; |
1801 | | } |
1802 | | if (target2[index] != NULL) |
1803 | | { |
1804 | | (*d3dintf->surface.release)(target2[index]); |
1805 | | target2[index] = NULL; |
1806 | | } |
1807 | | if (target3[index] != NULL) |
1808 | | { |
1809 | | (*d3dintf->surface.release)(target3[index]); |
1810 | | target3[index] = NULL; |
1811 | | } |
1812 | | if (target4[index] != NULL) |
1813 | | { |
1814 | | (*d3dintf->surface.release)(target4[index]); |
1815 | | target4[index] = NULL; |
1816 | | } |
1817 | | if (smalltarget0[index] != NULL) |
1818 | | { |
1819 | | (*d3dintf->surface.release)(smalltarget0[index]); |
1820 | | smalltarget0[index] = NULL; |
1821 | | } |
1822 | | if(last_texture[index] != NULL) |
1823 | | { |
1824 | | (*d3dintf->texture.release)(last_texture[index]); |
1825 | | last_texture[index] = NULL; |
1826 | | } |
1827 | | if(last_target[index] != NULL) |
1828 | | { |
1829 | | (*d3dintf->surface.release)(last_target[index]); |
1830 | | last_target[index] = NULL; |
1831 | | } |
1832 | | target_use_count[index] = 0; |
1833 | | registered_targets--; |
1834 | | } |
1835 | | } |
1836 | | } |
1837 | 1781 | } |
1838 | 1782 | |
1839 | 1783 | |
r19912 | r19913 | |
1848 | 1792 | |
1849 | 1793 | d3d_info *d3d = (d3d_info *)window->drawdata; |
1850 | 1794 | |
1851 | | //printf("registering prescaled texture, seqid %d\n", texture->texinfo.seqid); |
1852 | | |
1853 | | int idx = cyclic_target_idx % 9; |
1854 | | |
1855 | 1795 | // Find the nearest prescale factor that is over our screen size |
1856 | 1796 | int hlsl_prescale_x = prescale_force_x ? prescale_force_x : 1; |
1857 | 1797 | if(!prescale_force_x) |
r19912 | r19913 | |
1867 | 1807 | prescale_size_y = hlsl_prescale_y; |
1868 | 1808 | } |
1869 | 1809 | |
1870 | | HRESULT result = (*d3dintf->device.create_texture)(d3d->device, scwidth * hlsl_prescale_x, scheight * hlsl_prescale_y, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture0[idx]); |
1871 | | if (result != D3D_OK) |
| 1810 | if (!add_render_target(d3d, texture, scwidth, scheight, hlsl_prescale_x, hlsl_prescale_y)) |
1872 | 1811 | return 1; |
1873 | | (*d3dintf->texture.get_surface_level)(texture0[idx], 0, &target0[idx]); |
1874 | 1812 | |
1875 | | result = (*d3dintf->device.create_texture)(d3d->device, scwidth * hlsl_prescale_x, scheight * hlsl_prescale_y, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture1[idx]); |
1876 | | if (result != D3D_OK) |
1877 | | return 1; |
1878 | | (*d3dintf->texture.get_surface_level)(texture1[idx], 0, &target1[idx]); |
| 1813 | options->params_dirty = true; |
1879 | 1814 | |
1880 | | result = (*d3dintf->device.create_texture)(d3d->device, scwidth * hlsl_prescale_x, scheight * hlsl_prescale_y, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture2[idx]); |
1881 | | if (result != D3D_OK) |
1882 | | return 1; |
1883 | | (*d3dintf->texture.get_surface_level)(texture2[idx], 0, &target2[idx]); |
| 1815 | enumerate_screens(); |
1884 | 1816 | |
1885 | | result = (*d3dintf->device.create_texture)(d3d->device, scwidth * hlsl_prescale_x, scheight * hlsl_prescale_y, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture3[idx]); |
1886 | | if (result != D3D_OK) |
1887 | | return 1; |
1888 | | (*d3dintf->texture.get_surface_level)(texture3[idx], 0, &target3[idx]); |
| 1817 | return 0; |
| 1818 | } |
1889 | 1819 | |
1890 | | result = (*d3dintf->device.create_texture)(d3d->device, scwidth, scheight, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture4[idx]); |
1891 | | if (result != D3D_OK) |
1892 | | return 1; |
1893 | | (*d3dintf->texture.get_surface_level)(texture4[idx], 0, &target4[idx]); |
1894 | 1820 | |
1895 | | result = (*d3dintf->device.create_texture)(d3d->device, scwidth, scheight, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &smalltexture0[idx]); |
1896 | | if (result != D3D_OK) |
1897 | | return 1; |
1898 | | (*d3dintf->texture.get_surface_level)(smalltexture0[idx], 0, &smalltarget0[idx]); |
| 1821 | //============================================================ |
| 1822 | // hlsl_info::add_cache_target - register a cache target |
| 1823 | //============================================================ |
| 1824 | bool hlsl_info::add_cache_target(d3d_info* d3d, d3d_texture_info* info, int width, int height, int prescale_x, int prescale_y, int screen_index) |
| 1825 | { |
| 1826 | d3d_cache_target* target = (d3d_cache_target*)global_alloc_clear(d3d_cache_target); |
1899 | 1827 | |
1900 | | result = (*d3dintf->device.create_texture)(d3d->device, scwidth * hlsl_prescale_x, scheight * hlsl_prescale_y, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &prescaletexture0[idx]); |
1901 | | if (result != D3D_OK) |
1902 | | return 1; |
1903 | | (*d3dintf->texture.get_surface_level)(prescaletexture0[idx], 0, &prescaletarget0[idx]); |
| 1828 | if (!target->init(d3d, d3dintf, width, height, prescale_x, prescale_y)) |
| 1829 | { |
| 1830 | global_free(target); |
| 1831 | return false; |
| 1832 | } |
1904 | 1833 | |
1905 | | result = (*d3dintf->device.create_texture)(d3d->device, scwidth * hlsl_prescale_x, scheight * hlsl_prescale_y, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &last_texture[idx]); |
1906 | | if (result != D3D_OK) |
1907 | | return 1; |
1908 | | (*d3dintf->texture.get_surface_level)(last_texture[idx], 0, &last_target[idx]); |
| 1834 | target->next = cachehead; |
| 1835 | target->prev = NULL; |
1909 | 1836 | |
1910 | | texture->target_index = cyclic_target_idx; |
1911 | | target_width[idx] = scwidth * hlsl_prescale_x; |
1912 | | target_height[idx] = scheight * hlsl_prescale_y; |
1913 | | target_use_count[idx] = 60; |
1914 | | target_in_use[idx] = texture; |
1915 | | raw_target_idx[idx] = cyclic_target_idx; |
1916 | | registered_targets++; |
1917 | | cyclic_target_idx++; |
| 1837 | target->screen_index = screen_index; |
| 1838 | target->ref_count = 1; |
1918 | 1839 | |
1919 | | options->params_dirty = true; |
| 1840 | if (cachehead != NULL) |
| 1841 | { |
| 1842 | cachehead->prev = target; |
| 1843 | } |
| 1844 | cachehead = target; |
1920 | 1845 | |
1921 | | enumerate_screens(); |
| 1846 | return true; |
| 1847 | } |
1922 | 1848 | |
1923 | | return 0; |
| 1849 | //============================================================ |
| 1850 | // hlsl_info::add_render_target - register a render target |
| 1851 | //============================================================ |
| 1852 | |
| 1853 | bool hlsl_info::add_render_target(d3d_info* d3d, d3d_texture_info* info, int width, int height, int prescale_x, int prescale_y) |
| 1854 | { |
| 1855 | d3d_render_target* target = (d3d_render_target*)global_alloc_clear(d3d_render_target); |
| 1856 | |
| 1857 | if (!target->init(d3d, d3dintf, width, height, prescale_x, prescale_y)) |
| 1858 | { |
| 1859 | global_free(target); |
| 1860 | return false; |
| 1861 | } |
| 1862 | |
| 1863 | target->info = info; |
| 1864 | |
| 1865 | UINT32 screen_index_data = (UINT32)info->texinfo.osddata; |
| 1866 | target->screen_index = screen_index_data >> 1; |
| 1867 | target->page_index = screen_index_data & 1; |
| 1868 | |
| 1869 | d3d_cache_target* cache = find_cache_target(target->screen_index); |
| 1870 | if (cache == NULL) |
| 1871 | { |
| 1872 | if (!add_cache_target(d3d, info, width, height, prescale_x, prescale_y, target->screen_index)) |
| 1873 | { |
| 1874 | global_free(target); |
| 1875 | return false; |
| 1876 | } |
| 1877 | } |
| 1878 | else |
| 1879 | { |
| 1880 | cache->ref_count++; |
| 1881 | } |
| 1882 | |
| 1883 | target->next = targethead; |
| 1884 | target->prev = NULL; |
| 1885 | |
| 1886 | if (targethead != NULL) |
| 1887 | { |
| 1888 | targethead->prev = target; |
| 1889 | } |
| 1890 | targethead = target; |
| 1891 | |
| 1892 | return true; |
1924 | 1893 | } |
1925 | 1894 | |
1926 | 1895 | //============================================================ |
r19912 | r19913 | |
1938 | 1907 | |
1939 | 1908 | int hlsl_info::register_texture(d3d_texture_info *texture) |
1940 | 1909 | { |
| 1910 | enumerate_screens(); |
| 1911 | |
1941 | 1912 | if (!master_enable || !d3dintf->post_fx_available) |
1942 | 1913 | return 0; |
1943 | 1914 | |
1944 | 1915 | d3d_info *d3d = (d3d_info *)window->drawdata; |
1945 | 1916 | |
1946 | | //printf("registering unscaled texture, seqid %d\n", texture->texinfo.seqid); |
1947 | | |
1948 | | int idx = cyclic_target_idx % 9; |
1949 | | |
1950 | 1917 | // Find the nearest prescale factor that is over our screen size |
1951 | 1918 | int hlsl_prescale_x = prescale_force_x ? prescale_force_x : 1; |
1952 | 1919 | if(!prescale_force_x) |
r19912 | r19913 | |
1962 | 1929 | prescale_size_y = hlsl_prescale_y; |
1963 | 1930 | } |
1964 | 1931 | |
1965 | | HRESULT result = (*d3dintf->device.create_texture)(d3d->device, texture->rawwidth * hlsl_prescale_x, texture->rawheight * hlsl_prescale_y, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture0[idx]); |
1966 | | if (result != D3D_OK) |
| 1932 | if (!add_render_target(d3d, texture, texture->rawwidth, texture->rawheight, hlsl_prescale_x, hlsl_prescale_y)) |
1967 | 1933 | return 1; |
1968 | | (*d3dintf->texture.get_surface_level)(texture0[idx], 0, &target0[idx]); |
1969 | 1934 | |
1970 | | result = (*d3dintf->device.create_texture)(d3d->device, texture->rawwidth * hlsl_prescale_x, texture->rawheight * hlsl_prescale_y, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture1[idx]); |
1971 | | if (result != D3D_OK) |
1972 | | return 1; |
1973 | | (*d3dintf->texture.get_surface_level)(texture1[idx], 0, &target1[idx]); |
1974 | | |
1975 | | result = (*d3dintf->device.create_texture)(d3d->device, texture->rawwidth * hlsl_prescale_x, texture->rawheight * hlsl_prescale_y, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture2[idx]); |
1976 | | if (result != D3D_OK) |
1977 | | return 1; |
1978 | | (*d3dintf->texture.get_surface_level)(texture2[idx], 0, &target2[idx]); |
1979 | | |
1980 | | result = (*d3dintf->device.create_texture)(d3d->device, texture->rawwidth, texture->rawheight, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture3[idx]); |
1981 | | if (result != D3D_OK) |
1982 | | return 1; |
1983 | | (*d3dintf->texture.get_surface_level)(texture3[idx], 0, &target3[idx]); |
1984 | | |
1985 | | result = (*d3dintf->device.create_texture)(d3d->device, texture->rawwidth, texture->rawheight, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture4[idx]); |
1986 | | if (result != D3D_OK) |
1987 | | return 1; |
1988 | | (*d3dintf->texture.get_surface_level)(texture4[idx], 0, &target4[idx]); |
1989 | | |
1990 | | result = (*d3dintf->device.create_texture)(d3d->device, texture->rawwidth, texture->rawheight, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &smalltexture0[idx]); |
1991 | | if (result != D3D_OK) |
1992 | | return 1; |
1993 | | (*d3dintf->texture.get_surface_level)(smalltexture0[idx], 0, &smalltarget0[idx]); |
1994 | | |
1995 | | result = (*d3dintf->device.create_texture)(d3d->device, texture->rawwidth * hlsl_prescale_x, texture->rawheight * hlsl_prescale_y, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &prescaletexture0[idx]); |
1996 | | if (result != D3D_OK) |
1997 | | return 1; |
1998 | | (*d3dintf->texture.get_surface_level)(prescaletexture0[idx], 0, &prescaletarget0[idx]); |
1999 | | |
2000 | | result = (*d3dintf->device.create_texture)(d3d->device, texture->rawwidth * hlsl_prescale_x, texture->rawheight * hlsl_prescale_y, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &last_texture[idx]); |
2001 | | if (result != D3D_OK) |
2002 | | return 1; |
2003 | | (*d3dintf->texture.get_surface_level)(last_texture[idx], 0, &last_target[idx]); |
2004 | | |
2005 | | texture->target_index = cyclic_target_idx; |
2006 | | target_width[idx] = texture->rawwidth * hlsl_prescale_x; |
2007 | | target_height[idx] = texture->rawheight * hlsl_prescale_y; |
2008 | | target_use_count[idx] = 60; |
2009 | | target_in_use[idx] = texture; |
2010 | | raw_target_idx[idx] = cyclic_target_idx; |
2011 | | registered_targets++; |
2012 | | cyclic_target_idx++; |
2013 | | |
2014 | 1935 | options->params_dirty = true; |
2015 | 1936 | |
2016 | | enumerate_screens(); |
2017 | | |
2018 | 1937 | return 0; |
2019 | 1938 | } |
2020 | 1939 | |
r19912 | r19913 | |
2136 | 2055 | |
2137 | 2056 | for (int index = 0; index < 9; index++) |
2138 | 2057 | { |
2139 | | if (prescaletexture0[index] != NULL) |
2140 | | { |
2141 | | (*d3dintf->texture.release)(prescaletexture0[index]); |
2142 | | prescaletexture0[index] = NULL; |
2143 | | } |
2144 | | if (texture0[index] != NULL) |
2145 | | { |
2146 | | (*d3dintf->texture.release)(texture0[index]); |
2147 | | texture0[index] = NULL; |
2148 | | } |
2149 | | if (texture1[index] != NULL) |
2150 | | { |
2151 | | (*d3dintf->texture.release)(texture1[index]); |
2152 | | texture1[index] = NULL; |
2153 | | } |
2154 | | if (texture2[index] != NULL) |
2155 | | { |
2156 | | (*d3dintf->texture.release)(texture2[index]); |
2157 | | texture2[index] = NULL; |
2158 | | } |
2159 | | if (texture3[index] != NULL) |
2160 | | { |
2161 | | (*d3dintf->texture.release)(texture3[index]); |
2162 | | texture3[index] = NULL; |
2163 | | } |
2164 | | if (texture4[index] != NULL) |
2165 | | { |
2166 | | (*d3dintf->texture.release)(texture4[index]); |
2167 | | texture4[index] = NULL; |
2168 | | } |
2169 | | if (smalltexture0[index] != NULL) |
2170 | | { |
2171 | | (*d3dintf->texture.release)(smalltexture0[index]); |
2172 | | smalltexture0[index] = NULL; |
2173 | | } |
2174 | | if (prescaletarget0[index] != NULL) |
2175 | | { |
2176 | | (*d3dintf->surface.release)(prescaletarget0[index]); |
2177 | | prescaletarget0[index] = NULL; |
2178 | | } |
2179 | | if (target0[index] != NULL) |
2180 | | { |
2181 | | (*d3dintf->surface.release)(target0[index]); |
2182 | | target0[index] = NULL; |
2183 | | } |
2184 | | if (target1[index] != NULL) |
2185 | | { |
2186 | | (*d3dintf->surface.release)(target1[index]); |
2187 | | target1[index] = NULL; |
2188 | | } |
2189 | | if (target2[index] != NULL) |
2190 | | { |
2191 | | (*d3dintf->surface.release)(target2[index]); |
2192 | | target2[index] = NULL; |
2193 | | } |
2194 | | if (target3[index] != NULL) |
2195 | | { |
2196 | | (*d3dintf->surface.release)(target3[index]); |
2197 | | target3[index] = NULL; |
2198 | | } |
2199 | | if (target4[index] != NULL) |
2200 | | { |
2201 | | (*d3dintf->surface.release)(target4[index]); |
2202 | | target4[index] = NULL; |
2203 | | } |
2204 | | if (smalltarget0[index] != NULL) |
2205 | | { |
2206 | | (*d3dintf->surface.release)(smalltarget0[index]); |
2207 | | smalltarget0[index] = NULL; |
2208 | | } |
2209 | | if (last_texture[index] != NULL) |
2210 | | { |
2211 | | (*d3dintf->texture.release)(last_texture[index]); |
2212 | | last_texture[index] = NULL; |
2213 | | } |
2214 | | if (last_target[index] != NULL) |
2215 | | { |
2216 | | (*d3dintf->surface.release)(last_target[index]); |
2217 | | last_target[index] = NULL; |
2218 | | } |
2219 | 2058 | } |
2220 | 2059 | |
2221 | 2060 | if (avi_copy_texture != NULL) |
r19912 | r19913 | |
2244 | 2083 | |
2245 | 2084 | global_free(options); |
2246 | 2085 | |
2247 | | registered_targets = 0; |
2248 | | |
2249 | 2086 | shadow_bitmap.reset(); |
2250 | 2087 | } |
2251 | 2088 | |