220 : struct
221 {
223 Helpers.CheckDisposed(this, intPtr);
224 if (data != null && data.Length != 0)
225 {
227 {
229 }
230 if (isSetting)
231 {
232 int num = 0;
234 {
235 do
236 {
238 {
239 num++;
240 continue;
241 }
242 throw GraphicsHelpers.GetExceptionFromResult(2147500036u);
243 }
245 }
246 int num2 = 0;
248 {
249 do
250 {
252 {
253 num2++;
254 continue;
255 }
256 throw GraphicsHelpers.GetExceptionFromResult(2147500036u);
257 }
259 }
260 }
262
264 IDirect3DTexture9* ptr =
pComPtr;
265 int num3 = ((delegate* unmanaged[Stdcall, Stdcall]<
IntPtr, uint, _D3DSURFACE_DESC*,
int>)(
int)(*(uint*)(*(
int*)ptr + 68)))((nint)ptr, (uint)level, &d3DSURFACE_DESC);
266 if (num3 < 0)
267 {
268 throw GraphicsHelpers.GetExceptionFromResult((uint)num3);
269 }
270 Helpers.ValidateCopyParameters(data.Length,
startIndex, elementCount);
273 Texture.GetAndValidateSizes<T>(&d3DSURFACE_DESC, &dwFormatSize, &dwElementSize);
276 Texture.GetAndValidateRect(&d3DSURFACE_DESC, &dwLockWidth, &dwLockHeight, rect);
277 Texture.ValidateTotalSize(&d3DSURFACE_DESC, dwLockWidth, dwLockHeight, dwFormatSize, dwElementSize, (uint)elementCount);
278 tagRECT* ptr2 = null;
279 Rectangle rectangle = default(Rectangle);
280 if (rect.HasValue)
281 {
282 rectangle = rect.Value;
283 ptr2 = (tagRECT*)(int)(ref rectangle);
284 if (ptr2 != null)
285 {
286 *(int*)((byte*)ptr2 + 8) += *(int*)ptr2;
287 *(int*)((byte*)ptr2 + 12) += *(int*)((byte*)ptr2 + 4);
288 }
289 }
290 int num5;
293 {
294 if (!isSetting)
295 {
300 int num4 = *(
int*)GraphicsAdapter.
pComPtr + 40;
301 if (((delegate* unmanaged[Stdcall, Stdcall]<
IntPtr, uint, _D3DDEVTYPE, _D3DFORMAT, uint, _D3DRESOURCETYPE, _D3DFORMAT,
int>)(
int)(*(uint*)num4))((nint)GraphicsAdapter.pComPtr, graphicsDevice3.Adapter.adapter, graphicsDevice2._deviceType, _003CModule_003E.ConvertXnaFormatToWindowsAdapterFormat(graphicsDevice.Adapter.CurrentDisplayMode.Format), 1u, (_D3DRESOURCETYPE)3, *(_D3DFORMAT*)(&d3DSURFACE_DESC)) < 0)
302 {
304 }
305 }
306 IDirect3DSurface9* ptr3 = null;
307 IDirect3DTexture9* ptr4 = null;
308 IDirect3DSurface9* ptr5 = null;
310 num5 = ((delegate* unmanaged[Stdcall, Stdcall]<
IntPtr, uint, uint, uint, uint, _D3DFORMAT, _D3DPOOL, IDirect3DTexture9**,
void**,
int>)(
int)(*(uint*)(*(
int*)ptr6 + 92)))((nint)ptr6,
System.
Runtime.
CompilerServices.
Unsafe.As<_D3DSURFACE_DESC, uint>(ref
System.
Runtime.
CompilerServices.
Unsafe.AddByteOffset(ref d3DSURFACE_DESC, 24)),
System.
Runtime.
CompilerServices.
Unsafe.As<_D3DSURFACE_DESC, uint>(ref
System.
Runtime.
CompilerServices.
Unsafe.AddByteOffset(ref d3DSURFACE_DESC, 28)), 1u, 0u, *(_D3DFORMAT*)(&d3DSURFACE_DESC), (_D3DPOOL)2, &ptr4,
null);
311 if (num5 >= 0)
312 {
313 num5 = ((delegate* unmanaged[Stdcall, Stdcall]<
IntPtr, uint, IDirect3DSurface9**,
int>)(
int)(*(uint*)(*(
int*)ptr4 + 72)))((nint)ptr4, 0u, &ptr3);
314 if (num5 >= 0)
315 {
317 num5 = ((delegate* unmanaged[Stdcall, Stdcall]<
IntPtr, uint, IDirect3DSurface9**,
int>)(
int)(*(uint*)(*(
int*)ptr + 72)))((nint)ptr, (uint)level, &ptr5);
318 if (num5 >= 0)
319 {
320 if (isSetting)
321 {
323 {
324 num5 = _003CModule_003E.D3DXLoadSurfaceFromSurface(ptr3, null, null, ptr5, null, null, 1u, 0u);
325 }
326 if (num5 >= 0)
327 {
328 num5 = ((delegate* unmanaged[Stdcall, Stdcall]<
IntPtr, _D3DLOCKED_RECT*, tagRECT*, uint,
int>)(
int)(*(uint*)(*(
int*)ptr3 + 52)))((nint)ptr3, &d3DLOCKED_RECT, ptr2, 0u);
329 if (num5 >= 0)
330 {
331 try
332 {
333 Texture.CopyData((
void*)(int)
System.
Runtime.
CompilerServices.
Unsafe.As<_D3DLOCKED_RECT, uint>(ref
System.
Runtime.
CompilerServices.
Unsafe.AddByteOffset(ref d3DLOCKED_RECT, 4)), *(
int*)(&d3DLOCKED_RECT), data,
startIndex, elementCount, &d3DSURFACE_DESC, dwLockWidth, dwLockHeight, isSetting);
334 }
335 finally
336 {
337 IDirect3DSurface9* intPtr2 = ptr3;
338 num5 = ((delegate* unmanaged[Stdcall, Stdcall]<
IntPtr,
int>)(
int)(*(uint*)(*(
int*)intPtr2 + 56)))((nint)intPtr2);
339 }
340 if (num5 >= 0)
341 {
342 num5 = _003CModule_003E.D3DXLoadSurfaceFromSurface(ptr5, null, ptr2, ptr3, null, ptr2, 1u, 0u);
343 }
344 }
345 }
346 }
347 else
348 {
349 num5 = _003CModule_003E.D3DXLoadSurfaceFromSurface(ptr3, null, ptr2, ptr5, null, ptr2, 1u, 0u);
350 if (num5 >= 0)
351 {
352 num5 = ((delegate* unmanaged[Stdcall, Stdcall]<
IntPtr, _D3DLOCKED_RECT*, tagRECT*, uint,
int>)(
int)(*(uint*)(*(
int*)ptr3 + 52)))((nint)ptr3, &d3DLOCKED_RECT, ptr2, 0u);
353 if (num5 >= 0)
354 {
355 try
356 {
357 Texture.CopyData((
void*)(int)
System.
Runtime.
CompilerServices.
Unsafe.As<_D3DLOCKED_RECT, uint>(ref
System.
Runtime.
CompilerServices.
Unsafe.AddByteOffset(ref d3DLOCKED_RECT, 4)), *(
int*)(&d3DLOCKED_RECT), data,
startIndex, elementCount, &d3DSURFACE_DESC, dwLockWidth, dwLockHeight, isSetting: false);
358 }
359 finally
360 {
361 IDirect3DSurface9* intPtr3 = ptr3;
362 num5 = ((delegate* unmanaged[Stdcall, Stdcall]<
IntPtr,
int>)(
int)(*(uint*)(*(
int*)intPtr3 + 56)))((nint)intPtr3);
363 }
364 }
365 }
366 }
367 }
368 }
369 }
370 if (ptr5 != null)
371 {
372 IDirect3DSurface9* intPtr4 = ptr5;
373 ((delegate* unmanaged[Stdcall, Stdcall]<
IntPtr, uint>)(
int)(*(uint*)(*(
int*)intPtr4 + 8)))((nint)intPtr4);
374 ptr5 = null;
375 }
376 if (ptr3 != null)
377 {
378 IDirect3DSurface9* intPtr5 = ptr3;
379 ((delegate* unmanaged[Stdcall, Stdcall]<
IntPtr, uint>)(
int)(*(uint*)(*(
int*)intPtr5 + 8)))((nint)intPtr5);
380 ptr3 = null;
381 }
382 if (ptr4 != null)
383 {
384 IDirect3DTexture9* intPtr6 = ptr4;
385 ((delegate* unmanaged[Stdcall, Stdcall]<
IntPtr, uint>)(
int)(*(uint*)(*(
int*)intPtr6 + 8)))((nint)intPtr6);
386 ptr4 = null;
387 }
388 }
389 else
390 {
392 num5 = ((delegate* unmanaged[Stdcall, Stdcall]<
IntPtr, uint, _D3DLOCKED_RECT*, tagRECT*, uint,
int>)(
int)(*(uint*)(*(
int*)ptr + 76)))((nint)ptr, (uint)level, &d3DLOCKED_RECT, ptr2,
options);
393 if (num5 >= 0)
394 {
395 try
396 {
397 Texture.CopyData((
void*)(int)
System.
Runtime.
CompilerServices.
Unsafe.As<_D3DLOCKED_RECT, uint>(ref
System.
Runtime.
CompilerServices.
Unsafe.AddByteOffset(ref d3DLOCKED_RECT, 4)), *(
int*)(&d3DLOCKED_RECT), data,
startIndex, elementCount, &d3DSURFACE_DESC, dwLockWidth, dwLockHeight, isSetting);
398 }
399 finally
400 {
402 num5 = ((delegate* unmanaged[Stdcall, Stdcall]<
IntPtr, uint,
int>)(
int)(*(uint*)(*(
int*)ptr + 80)))((nint)ptr, (uint)level);
403 }
404 }
405 }
407 {
408 if (isSetting)
409 {
410 return;
411 }
413 {
414 try
415 {
417
419 }
420 catch
421 {
422
423 ptr7 = null;
424 throw;
425 }
426 }
427 return;
428 }
429 if (num5 < 0)
430 {
431 throw GraphicsHelpers.GetExceptionFromResult((uint)num5);
432 }
433 if (isSetting)
434 {
435 if (this is IDynamicGraphicsResource dynamicGraphicsResource)
436 {
437 dynamicGraphicsResource.SetContentLost(isContentLost: false);
438 }
440 }
441 return;
442 }
444 }
TextureCollection Textures
TextureCollection VertexTextures
unsafe IDirect3DDevice9 * pComPtr
GraphicsDevice GraphicsDevice
unsafe IDirect3DTexture9 * pComPtr
bool renderTargetContentsDirty
bool isActiveRenderTarget
static unsafe void InitBlock(void *startAddress, byte value, uint byteCount)