Advertisement
Conmanx360

Untitled

Jul 15th, 2018
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. if (texture->resource.format_flags & WINED3DFMT_FLAG_DECOMPRESS)
  2. {
  3. struct wined3d_format temp;
  4.  
  5. temp.decompress = format->decompress;
  6. format = wined3d_get_format(gl_info, WINED3DFMT_B8G8R8A8_UNORM, WINED3DUSAGE_TEXTURE);
  7. f = *format;
  8. f.conv_byte_count = format->byte_count;
  9. f.upload = temp.decompress;
  10. format = &f;
  11. texture->resource.format_flags &= ~WINED3DFMT_FLAG_BLOCKS;
  12. }
  13.  
  14. if (format->upload)
  15. {
  16. unsigned int dst_row_pitch, dst_slice_pitch;
  17. void *src_mem;
  18.  
  19. if (texture->resource.format_flags & WINED3DFMT_FLAG_BLOCKS)
  20. ERR("Converting a block-based format.\n");
  21.  
  22. f = *format;
  23. f.byte_count = format->conv_byte_count;
  24. format = &f;
  25.  
  26. wined3d_format_calculate_pitch(format, 1, update_w, update_h, &dst_row_pitch, &dst_slice_pitch);
  27.  
  28. if (!(converted_mem = heap_calloc(update_d, dst_slice_pitch)))
  29. {
  30. ERR("Failed to allocate upload buffer.\n");
  31. return;
  32. }
  33.  
  34. src_mem = context_map_bo_address(context, &bo, src_slice_pitch,
  35. GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_READ);
  36. format->upload(src_mem, converted_mem, src_row_pitch, src_slice_pitch,
  37. dst_row_pitch, dst_slice_pitch, update_w, update_h, update_d);
  38. context_unmap_bo_address(context, &bo, GL_PIXEL_UNPACK_BUFFER);
  39.  
  40. bo.buffer_object = 0;
  41. bo.addr = converted_mem;
  42. src_row_pitch = dst_row_pitch;
  43. src_slice_pitch = dst_slice_pitch;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement