| 1050 | } |
| 1051 | |
| 1052 | ALResult Tr2TextureAL::UpdateSubresource( const Tr2TextureSubresource& region, const void* source, uint32_t pitch, uint32_t slicePitch, Tr2RenderContextAL& renderContext ) |
| 1053 | { |
| 1054 | if( HasFlag( m_cpuUsage, Tr2CpuUsage::WRITE_OFTEN ) ) |
| 1055 | { |
| 1056 | return E_INVALIDCALL; |
| 1057 | } |
| 1058 | if( !HasFlag( m_cpuUsage, Tr2CpuUsage::WRITE ) && !IsWritable( m_gpuUsage ) ) |
| 1059 | { |
| 1060 | return E_INVALIDCALL; |
| 1061 | } |
| 1062 | |
| 1063 | if( !IsValid() || !renderContext.IsValid() ) |
| 1064 | { |
| 1065 | return E_INVALIDCALL; |
| 1066 | } |
| 1067 | |
| 1068 | if( !region.IsValidForBitmap( m_desc ) ) |
| 1069 | { |
| 1070 | return E_INVALIDARG; |
| 1071 | } |
| 1072 | if( !region.IsSingleSubresource() ) |
| 1073 | { |
| 1074 | return E_INVALIDARG; |
| 1075 | } |
| 1076 | |
| 1077 | auto subResource = D3D10CalcSubresource( region.m_startMipLevel, region.m_startFace, m_desc.GetTrueMipCount() ); |
| 1078 | |
| 1079 | if( region.HasBox() ) |
| 1080 | { |
| 1081 | D3D11_BOX box; |
| 1082 | box.left = region.m_box.left; |
| 1083 | box.top = region.m_box.top; |
| 1084 | box.front = region.m_box.front; |
| 1085 | box.right = region.m_box.right; |
| 1086 | box.bottom = region.m_box.bottom; |
| 1087 | box.back = region.m_box.back; |
| 1088 | |
| 1089 | renderContext.m_context->UpdateSubresource( m_texture, subResource, &box, source, pitch, slicePitch ); |
| 1090 | } |
| 1091 | else |
| 1092 | { |
| 1093 | renderContext.m_context->UpdateSubresource( m_texture, subResource, nullptr, source, pitch, slicePitch ); |
| 1094 | } |
| 1095 | |
| 1096 | return S_OK; |
| 1097 | } |
| 1098 | |
| 1099 | ALResult Tr2TextureAL::CopySubresourceRegion( const Tr2TextureSubresource& destSubresource, Tr2TextureAL& source, const Tr2TextureSubresource& sourceSubresource, Tr2RenderContextAL& renderContext ) |
| 1100 | { |
no test coverage detected