| 87 | } |
| 88 | |
| 89 | void EnvironmentProbe::SetProbeData(GPUContext* context, GPUTexture* data) |
| 90 | { |
| 91 | // Remove probe asset (if used) |
| 92 | _isUsingCustomProbe = false; |
| 93 | _probe = nullptr; |
| 94 | |
| 95 | // Allocate probe texture manually |
| 96 | if (!_probeTexture) |
| 97 | { |
| 98 | _probeTexture = GPUTexture::New(); |
| 99 | #if !BUILD_RELEASE |
| 100 | _probeTexture->SetName(GetNamePath()); |
| 101 | #endif |
| 102 | } |
| 103 | if (_probeTexture->Width() != data->Width() || _probeTexture->Format() != data->Format()) |
| 104 | { |
| 105 | auto desc = data->GetDescription(); |
| 106 | desc.Usage = GPUResourceUsage::Default; |
| 107 | desc.Flags = GPUTextureFlags::ShaderResource; |
| 108 | if (_probeTexture->Init(desc)) |
| 109 | return; |
| 110 | _probeTexture->SetResidentMipLevels(_probeTexture->MipLevels()); |
| 111 | } |
| 112 | |
| 113 | // Copy probe texture data |
| 114 | context->CopyResource(_probeTexture, data); |
| 115 | } |
| 116 | |
| 117 | void EnvironmentProbe::SetProbeData(TextureData& data) |
| 118 | { |
nothing calls this directly
no test coverage detected