Skip to content

Commit

Permalink
refactor: remove "&" from ptrs
Browse files Browse the repository at this point in the history
  • Loading branch information
FlayaN committed Jan 31, 2025
1 parent 3d859b1 commit 7053db8
Show file tree
Hide file tree
Showing 16 changed files with 38 additions and 38 deletions.
14 changes: 7 additions & 7 deletions src/Deferred.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct BlendStates
void SetupRenderTarget(RE::RENDER_TARGET target, D3D11_TEXTURE2D_DESC texDesc, D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc, D3D11_RENDER_TARGET_VIEW_DESC rtvDesc, D3D11_UNORDERED_ACCESS_VIEW_DESC uavDesc, DXGI_FORMAT format, uint bindFlags)
{
auto renderer = globals::game::renderer;
auto& device = globals::d3d::device;
auto device = globals::d3d::device;

texDesc.BindFlags = bindFlags;
texDesc.Format = format;
Expand Down Expand Up @@ -106,7 +106,7 @@ void Deferred::SetupResources()
}

{
auto& device = globals::d3d::device;
auto device = globals::d3d::device;

D3D11_SAMPLER_DESC samplerDesc = {};
samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
Expand Down Expand Up @@ -182,7 +182,7 @@ void Deferred::CopyShadowData()
ZoneScoped;
TracyD3D11Zone(globals::state->tracyCtx, "CopyShadowData");

auto& context = globals::d3d::context;
auto context = globals::d3d::context;

ID3D11UnorderedAccessView* uavs[1]{ perShadow->uav.get() };
context->CSSetUnorderedAccessViews(0, 1, uavs, nullptr);
Expand Down Expand Up @@ -299,7 +299,7 @@ void Deferred::StartDeferred()
deferredPass = true;

{
auto& context = globals::d3d::context;
auto context = globals::d3d::context;

static REL::Relocation<ID3D11Buffer**> perFrame{ REL::RelocationID(524768, 411384) };
ID3D11Buffer* buffers[1] = { *perFrame.get() };
Expand Down Expand Up @@ -329,7 +329,7 @@ void Deferred::DeferredPasses()
TracyD3D11Zone(globals::state->tracyCtx, "Deferred");

auto renderer = globals::game::renderer;
auto& context = globals::d3d::context;
auto context = globals::d3d::context;

{
static REL::Relocation<ID3D11Buffer**> perFrame{ REL::RelocationID(524768, 411384) };
Expand Down Expand Up @@ -502,7 +502,7 @@ void Deferred::EndDeferred()
renderTargets[i] = RE::RENDER_TARGET::kNONE;
}

auto& context = globals::d3d::context;
auto context = globals::d3d::context;
context->OMSetRenderTargets(0, nullptr, nullptr); // Unbind all bound render targets

DeferredPasses(); // Perform deferred passes and composite forward buffers
Expand All @@ -520,7 +520,7 @@ void Deferred::OverrideBlendStates()

static std::once_flag setup;
std::call_once(setup, [&]() {
auto& device = globals::d3d::device;
auto device = globals::d3d::device;

for (int a = 0; a < 7; a++) {
for (int b = 0; b < 2; b++) {
Expand Down
6 changes: 3 additions & 3 deletions src/Features/CloudShadows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ void CloudShadows::CheckResourcesSide(int side)
if (!frame_checker[side].IsNewFrame())
return;

auto& context = globals::d3d::context;
auto context = globals::d3d::context;

float black[4] = { 0, 0, 0, 0 };
context->ClearRenderTargetView(cubemapCloudOccRTVs[side], black);
Expand Down Expand Up @@ -73,7 +73,7 @@ void CloudShadows::EarlyPrepass()
!globals::game::sky->currentClimate)
return;

auto& context = globals::d3d::context;
auto context = globals::d3d::context;

ID3D11ShaderResourceView* srv = texCubemapCloudOcc->srv.get();
context->PSSetShaderResources(25, 1, &srv);
Expand All @@ -83,7 +83,7 @@ void CloudShadows::EarlyPrepass()
void CloudShadows::SetupResources()
{
auto renderer = globals::game::renderer;
auto& device = globals::d3d::device;
auto device = globals::d3d::device;

{
auto reflections = renderer->GetRendererData().cubemapRenderTargets[RE::RENDER_TARGET_CUBEMAP::kREFLECTIONS];
Expand Down
14 changes: 7 additions & 7 deletions src/Features/DynamicCubemaps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ void DynamicCubemaps::DrawSettings()
ImGui::ColorEdit3("Color", reinterpret_cast<float*>(&settings.CubemapColor));
ImGui::SliderFloat("Roughness", &settings.CubemapColor.w, 0.0f, 1.0f, "%.2f");
if (ImGui::Button("Export")) {
auto& device = globals::d3d::device;
auto& context = globals::d3d::context;
auto device = globals::d3d::device;
auto context = globals::d3d::context;

D3D11_TEXTURE2D_DESC texDesc{};
texDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
Expand Down Expand Up @@ -295,7 +295,7 @@ ID3D11ComputeShader* DynamicCubemaps::GetComputeShaderSpecularIrradiance()
void DynamicCubemaps::UpdateCubemapCapture(bool a_reflections)
{
auto renderer = globals::game::renderer;
auto& context = globals::d3d::context;
auto context = globals::d3d::context;

auto& depth = renderer->GetDepthStencilData().depthStencils[RE::RENDER_TARGETS_DEPTHSTENCIL::kPOST_ZPREPASS_COPY];
auto& main = renderer->GetRuntimeData().renderTargets[RE::RENDER_TARGETS::kMAIN];
Expand Down Expand Up @@ -367,7 +367,7 @@ void DynamicCubemaps::UpdateCubemapCapture(bool a_reflections)
void DynamicCubemaps::Inferrence(bool a_reflections)
{
auto renderer = globals::game::renderer;
auto& context = globals::d3d::context;
auto context = globals::d3d::context;

// Infer local reflection information
ID3D11UnorderedAccessView* uav = envInferredTexture->uav.get();
Expand Down Expand Up @@ -404,7 +404,7 @@ void DynamicCubemaps::Inferrence(bool a_reflections)

void DynamicCubemaps::Irradiance(bool a_reflections)
{
auto& context = globals::d3d::context;
auto context = globals::d3d::context;

// Copy cubemap to other resources
for (uint face = 0; face < 6; face++) {
Expand Down Expand Up @@ -503,7 +503,7 @@ void DynamicCubemaps::UpdateCubemap()

void DynamicCubemaps::PostDeferred()
{
auto& context = globals::d3d::context;
auto context = globals::d3d::context;

ID3D11ShaderResourceView* views[2] = { (activeReflections ? envReflectionsTexture : envTexture)->srv.get(), envTexture->srv.get() };
context->PSSetShaderResources(30, 2, views);
Expand All @@ -518,7 +518,7 @@ void DynamicCubemaps::SetupResources()
GetComputeShaderSpecularIrradiance();

auto renderer = globals::game::renderer;
auto& device = globals::d3d::device;
auto device = globals::d3d::device;

{
D3D11_SAMPLER_DESC samplerDesc = {};
Expand Down
2 changes: 1 addition & 1 deletion src/Features/GrassCollision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ void GrassCollision::Update()
updatePerFrame = false;
}

auto& context = globals::d3d::context;
auto context = globals::d3d::context;

static Util::FrameChecker frameChecker;
if (frameChecker.IsNewFrame()) {
Expand Down
4 changes: 2 additions & 2 deletions src/Features/ScreenSpaceGI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ void ScreenSpaceGI::SaveSettings(json& o_json)
void ScreenSpaceGI::SetupResources()
{
auto renderer = globals::game::renderer;
auto& device = globals::d3d::device;
auto device = globals::d3d::device;

logger::debug("Creating buffers...");
{
Expand Down Expand Up @@ -621,7 +621,7 @@ void ScreenSpaceGI::UpdateSB()

void ScreenSpaceGI::DrawSSGI(Texture2D* srcPrevAmbient)
{
auto& context = globals::d3d::context;
auto context = globals::d3d::context;

if (!(settings.Enabled && ShadersOK())) {
FLOAT clr[4] = { 0.f, 0.f, 0.f, 0.f };
Expand Down
2 changes: 1 addition & 1 deletion src/Features/ScreenSpaceShadows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ void ScreenSpaceShadows::SetupResources()
raymarchCB = new ConstantBuffer(ConstantBufferDesc<RaymarchCB>());

{
auto& device = globals::d3d::device;
auto device = globals::d3d::device;

D3D11_SAMPLER_DESC samplerDesc = {};
samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
Expand Down
6 changes: 3 additions & 3 deletions src/Features/Skylighting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void Skylighting::RestoreDefaultSettings()

void Skylighting::ResetSkylighting()
{
auto& context = globals::d3d::context;
auto context = globals::d3d::context;
UINT clr[1] = { 0 };
context->ClearUnorderedAccessViewUint(texAccumFramesArray->uav.get(), clr);
queuedResetSkylighting = false;
Expand Down Expand Up @@ -63,7 +63,7 @@ void Skylighting::DrawSettings()
void Skylighting::SetupResources()
{
auto renderer = globals::game::renderer;
auto& device = globals::d3d::device;
auto device = globals::d3d::device;

{
auto& precipitationOcclusion = renderer->GetDepthStencilData().depthStencils[RE::RENDER_TARGETS_DEPTHSTENCIL::kPRECIPITATION_OCCLUSION_MAP];
Expand Down Expand Up @@ -235,7 +235,7 @@ void Skylighting::Prepass()

TracyD3D11Zone(globals::state->tracyCtx, "Skylighting - Update Probes");

auto& context = globals::d3d::context;
auto context = globals::d3d::context;

{
std::array<ID3D11ShaderResourceView*, 1> srvs = { texOcclusion->srv.get() };
Expand Down
2 changes: 1 addition & 1 deletion src/Features/SubsurfaceScattering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ void SubsurfaceScattering::DrawSSS()
}

auto renderer = globals::game::renderer;
auto& context = globals::d3d::context;
auto context = globals::d3d::context;

{
ID3D11Buffer* buffer[1] = { blurCB->CB() };
Expand Down
4 changes: 2 additions & 2 deletions src/Features/TerrainBlending.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ID3D11ComputeShader* TerrainBlending::GetDepthBlendShader()
void TerrainBlending::SetupResources()
{
auto renderer = globals::game::renderer;
auto& device = globals::d3d::device;
auto device = globals::d3d::device;

{
auto& mainDepth = renderer->GetDepthStencilData().depthStencils[RE::RENDER_TARGETS_DEPTHSTENCIL::kMAIN];
Expand Down Expand Up @@ -144,7 +144,7 @@ void TerrainBlending::ResetTerrainDepth()

void TerrainBlending::BlendPrepassDepths()
{
auto& context = globals::d3d::context;
auto context = globals::d3d::context;
context->OMSetRenderTargets(0, nullptr, nullptr);

auto dispatchCount = Util::GetScreenDispatchCount();
Expand Down
4 changes: 2 additions & 2 deletions src/Features/TerrainShadows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ void TerrainShadows::LoadHeightmap()
if (cachedHeightmap && cachedHeightmap->worldspace == worldspace_name) // already cached
return;

auto& device = globals::d3d::device;
auto device = globals::d3d::device;

logger::debug("Loading height map...");
{
Expand Down Expand Up @@ -304,7 +304,7 @@ void TerrainShadows::UpdateShadow()
constexpr uint updateLength = 128u;
constexpr uint logUpdateLength = std::bit_width(128u) - 1; // integer log2, https://stackoverflow.com/questions/994593/how-to-do-an-integer-log2-in-c

auto& context = globals::d3d::context;
auto context = globals::d3d::context;
auto accumulator = RE::BSGraphics::BSShaderAccumulator::GetCurrentAccumulator();
auto sunLight = skyrim_cast<RE::NiDirectionalLight*>(accumulator->GetRuntimeData().activeShadowSceneNode->GetRuntimeData().sunLight->light.get());
if (!sunLight)
Expand Down
6 changes: 3 additions & 3 deletions src/Features/WaterEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

void WaterEffects::SetupResources()
{
auto& device = globals::d3d::device;
auto& context = globals::d3d::context;
auto device = globals::d3d::device;
auto context = globals::d3d::context;

DirectX::CreateDDSTextureFromFile(device, context, L"Data\\Shaders\\WaterEffects\\watercaustics.dds", nullptr, causticsView.put());
}

void WaterEffects::Prepass()
{
auto& context = globals::d3d::context;
auto context = globals::d3d::context;
auto srv = causticsView.get();
context->PSSetShaderResources(65, 1, &srv);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Features/WetnessEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ void WetnessEffects::Prepass()
static auto renderer = globals::game::renderer;
static auto& precipOcclusionTexture = renderer->GetDepthStencilData().depthStencils[RE::RENDER_TARGETS_DEPTHSTENCIL::kPRECIPITATION_OCCLUSION_MAP];

auto& context = globals::d3d::context;
auto context = globals::d3d::context;

context->PSSetShaderResources(70, 1, &precipOcclusionTexture.depthSRV);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Streamline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ void Streamline::CopyResourcesToSharedBuffers()
if (!(featureDLSSG && !REL::Module::IsVR()) || settings.frameGenerationMode == sl::DLSSGMode::eOff)
return;

auto& context = globals::d3d::context;
auto context = globals::d3d::context;
auto renderer = globals::game::renderer;

ID3D11RenderTargetView* backupViews[8];
Expand Down
2 changes: 1 addition & 1 deletion src/TruePBR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1407,7 +1407,7 @@ struct BSGrassShader_SetupMaterial
{
static void thunk(RE::BSShader* shader, RE::BSLightingShaderMaterialBase const* material)
{
const auto& state = globals::state;
const auto state = globals::state;
const auto technique = static_cast<SIE::ShaderCache::GrassShaderTechniques>(state->currentPixelDescriptor & 0b1111);

const auto& grassPSConstants = ShaderConstants::GrassPS::Get();
Expand Down
4 changes: 2 additions & 2 deletions src/Upscaling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ void Upscaling::Upscale()

auto state = globals::state;

auto& context = globals::d3d::context;
auto context = globals::d3d::context;

ID3D11ShaderResourceView* inputTextureSRV;
context->PSGetShaderResources(0, 1, &inputTextureSRV);
Expand Down Expand Up @@ -345,7 +345,7 @@ void Upscaling::SharpenTAA()
CheckResources();

auto state = globals::state;
auto& context = globals::d3d::context;
auto context = globals::d3d::context;

ID3D11ShaderResourceView* inputTextureSRV;
context->PSGetShaderResources(0, 1, &inputTextureSRV);
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/D3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ namespace Util

ID3D11DeviceChild* CompileShader(const wchar_t* FilePath, const std::vector<std::pair<const char*, const char*>>& Defines, const char* ProgramType, const char* Program)
{
auto& device = globals::d3d::device;
auto device = globals::d3d::device;

CustomInclude include;

Expand Down

0 comments on commit 7053db8

Please sign in to comment.