| 137 | |
| 138 | |
| 139 | PostFXContext::PostFXContext(IRenderDevice* pDevice, const CreateInfo& CI) : |
| 140 | m_Settings{CI} |
| 141 | { |
| 142 | DEV_CHECK_ERR(pDevice != nullptr, "pDevice must not be null"); |
| 143 | const auto& DeviceInfo = pDevice->GetDeviceInfo(); |
| 144 | |
| 145 | m_SupportedFeatures.TransitionSubresources = DeviceInfo.Type == RENDER_DEVICE_TYPE_D3D12 || DeviceInfo.Type == RENDER_DEVICE_TYPE_VULKAN; |
| 146 | m_SupportedFeatures.TextureSubresourceViews = DeviceInfo.Features.TextureSubresourceViews; |
| 147 | m_SupportedFeatures.CopyDepthToColor = DeviceInfo.IsD3DDevice(); |
| 148 | m_SupportedFeatures.ShaderBaseVertexOffset = !DeviceInfo.IsD3DDevice(); |
| 149 | |
| 150 | RenderDeviceWithCache_N Device{pDevice}; |
| 151 | { |
| 152 | TextureDesc Desc; |
| 153 | Desc.Name = "PostFXContext::SobolBuffer"; |
| 154 | Desc.Type = RESOURCE_DIM_TEX_2D; // We use RESOURCE_DIM_TEX_2D, because WebGL doesn't support glTexStorage1D() |
| 155 | Desc.Width = 256; |
| 156 | Desc.Height = 1; |
| 157 | Desc.Format = TEX_FORMAT_R8_UINT; |
| 158 | Desc.MipLevels = 1; |
| 159 | Desc.BindFlags = BIND_SHADER_RESOURCE; |
| 160 | |
| 161 | TextureSubResData SubResData; |
| 162 | SubResData.pData = NoiseBuffers::Sobol_256d; |
| 163 | SubResData.Stride = Desc.Width; |
| 164 | |
| 165 | TextureData Data; |
| 166 | Data.pContext = nullptr; |
| 167 | Data.NumSubresources = 1; |
| 168 | Data.pSubResources = &SubResData; |
| 169 | m_Resources.Insert(RESOURCE_IDENTIFIER_SOBOL_BUFFER, Device.CreateTexture(Desc, &Data)); |
| 170 | } |
| 171 | |
| 172 | { |
| 173 | TextureDesc Desc; |
| 174 | Desc.Name = "PostFXContext::ScramblingTileBuffer"; |
| 175 | Desc.Type = RESOURCE_DIM_TEX_2D; |
| 176 | Desc.Width = 128 * 4; |
| 177 | Desc.Height = 128 * 2; |
| 178 | Desc.Format = TEX_FORMAT_R8_UINT; |
| 179 | Desc.MipLevels = 1; |
| 180 | Desc.BindFlags = BIND_SHADER_RESOURCE; |
| 181 | |
| 182 | TextureSubResData SubResData; |
| 183 | SubResData.pData = NoiseBuffers::ScramblingTile; |
| 184 | SubResData.Stride = Desc.Width; |
| 185 | |
| 186 | TextureData Data; |
| 187 | Data.pContext = nullptr; |
| 188 | Data.NumSubresources = 1; |
| 189 | Data.pSubResources = &SubResData; |
| 190 | m_Resources.Insert(RESOURCE_IDENTIFIER_SCRAMBLING_TILE_BUFFER, Device.CreateTexture(Desc, &Data)); |
| 191 | } |
| 192 | |
| 193 | for (Uint32 TextureIdx = RESOURCE_IDENTIFIER_BLUE_NOISE_TEXTURE_XY; TextureIdx <= RESOURCE_IDENTIFIER_BLUE_NOISE_TEXTURE_ZW; TextureIdx++) |
| 194 | { |
| 195 | TextureDesc Desc; |
| 196 | Desc.Name = "PostFXContext::BlueNoiseTexture"; |
nothing calls this directly
no test coverage detected