mirror of
https://github.com/jmarshall23/DoomRTX.git
synced 2026-08-17 19:23:51 +02:00
Fixed MD5 models.
GI now bounces off textures properly.
This commit is contained in:
@@ -287,6 +287,7 @@ void APIENTRY glTextureSpecularMap(GLuint texture, GLboolean isSpecularMap);
|
||||
void APIENTRY glBindSpecularMapTexture(GLuint texture);
|
||||
void APIENTRY glSpecularMapTexture(GLuint texture);
|
||||
void APIENTRY glSpecularMapStrengthf(GLfloat strength);
|
||||
void APIENTRY glTextureAverageColorQD3D12(GLuint texture, GLfloat r, GLfloat g, GLfloat b, GLfloat a);
|
||||
void APIENTRY glRaytracingMaterialFlagsQD3D12(GLuint flags);
|
||||
void APIENTRY glRaytracingMaterialFlagQD3D12(GLuint flag, GLboolean enable);
|
||||
|
||||
@@ -301,6 +302,7 @@ void glRaytracingLightingSetSpecularInput(ID3D12Resource* texture, DXGI_FORMAT f
|
||||
void glRaytracingSetMeshMaterialFlags(glRaytracingMeshHandle_t meshHandle, uint32_t materialFlags);
|
||||
void glRaytracingSetMeshGlass(glRaytracingMeshHandle_t meshHandle, int isGlass);
|
||||
uint32_t glRaytracingGetMeshMaterialFlags(glRaytracingMeshHandle_t meshHandle);
|
||||
void glRaytracingSetMeshAverageColor(glRaytracingMeshHandle_t meshHandle, float r, float g, float b, float a);
|
||||
|
||||
// Fast TLAS instance visibility controls are implemented in gl_raytracing.cpp.
|
||||
// They flip the D3D12_RAYTRACING_INSTANCE_DESC InstanceMask via the existing
|
||||
@@ -334,6 +336,7 @@ void QD3D12_SetToneMapBrightness(float brightness);
|
||||
float QD3D12_GetToneMapBrightness(void);
|
||||
void QD3D12_SetFrameGenerationMultiplier(int multiplier);
|
||||
int QD3D12_GetFrameGenerationMultiplier(void);
|
||||
int QD3D12_GetActiveFrameGenerationMultiplier(void);
|
||||
void APIENTRY glToneMapBrightnessQD3D12(GLfloat brightness);
|
||||
void APIENTRY glToneMapBrightnessfQD3D12(GLfloat brightness);
|
||||
void APIENTRY glTonemapBrightnessQD3D12(GLfloat brightness);
|
||||
@@ -628,6 +631,7 @@ struct TextureResource
|
||||
bool isNormalMap = false;
|
||||
bool isGlowMap = false;
|
||||
bool isSpecularMap = false;
|
||||
float averageColor[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
|
||||
|
||||
ComPtr<ID3D12Resource> texture;
|
||||
D3D12_RESOURCE_STATES state = D3D12_RESOURCE_STATE_COPY_DEST;
|
||||
@@ -1504,7 +1508,7 @@ struct GLState
|
||||
bool motionHistoryReset = true;
|
||||
|
||||
QD3D12UpscalerBackend upscalerBackend = QD3D12_UPSCALER_DLSS;
|
||||
QD3D12UpscalerQuality upscalerQuality = QD3D12_QUALITY_DLAA;
|
||||
QD3D12UpscalerQuality upscalerQuality = QD3D12_QUALITY_QUALITY;
|
||||
bool enableInternalTAA = false;
|
||||
bool enableRayAIDenoise = false;
|
||||
bool enableDLSSRayReconstruction = false;
|
||||
@@ -1512,7 +1516,7 @@ struct GLState
|
||||
uint32_t frameGenerationMultiplier = 2;
|
||||
uint32_t pathTracingSamplesPerPixel = 1;
|
||||
uint32_t pathTracingFallbackSamplesPerPixel = 2;
|
||||
uint32_t pathTracingMaxBounces = 3;
|
||||
uint32_t pathTracingMaxBounces = 2;
|
||||
|
||||
float jitterX = 0.0f;
|
||||
float jitterY = 0.0f;
|
||||
@@ -6764,6 +6768,7 @@ struct QD3D12StreamlineState
|
||||
uint32_t lastDlssGEligibilityMaskLogged = 0xffffffffu;
|
||||
uint32_t lastDlssGFramesToGenerateLogged = 0xffffffffu;
|
||||
uint32_t lastDlssGPresentedFramesLogged = 0xffffffffu;
|
||||
uint32_t dlssGActiveFrameMultiplier = 1;
|
||||
uint32_t dlssGConfiguredFramesToGenerate = 0xffffffffu;
|
||||
uint32_t dlssGConfiguredRenderWidth = 0xffffffffu;
|
||||
uint32_t dlssGConfiguredRenderHeight = 0xffffffffu;
|
||||
@@ -6941,7 +6946,7 @@ static sl::DLSSMode QD3D12_MapDLSSMode(QD3D12UpscalerQuality quality)
|
||||
{
|
||||
switch (quality)
|
||||
{
|
||||
case QD3D12_QUALITY_QUALITY: return sl::DLSSMode::eUltraQuality;
|
||||
case QD3D12_QUALITY_QUALITY: return sl::DLSSMode::eMaxQuality;
|
||||
case QD3D12_QUALITY_BALANCED: return sl::DLSSMode::eBalanced;
|
||||
case QD3D12_QUALITY_PERFORMANCE: return sl::DLSSMode::eMaxPerformance;
|
||||
case QD3D12_QUALITY_ULTRA_PERFORMANCE: return sl::DLSSMode::eUltraPerformance;
|
||||
@@ -7219,15 +7224,15 @@ static void QD3D12_LogDLSSFrameGenerationEligibility(const QD3D12Window& w, uint
|
||||
|
||||
static void QD3D12_SetDLSSFrameGenerationOff()
|
||||
{
|
||||
if (!g_qd3d12Sl.deviceBound || !g_qd3d12Sl.dlssGSupported || !g_qd3d12Sl.dlssGActive)
|
||||
return;
|
||||
|
||||
sl::DLSSGOptions options{};
|
||||
options.mode = sl::DLSSGMode::eOff;
|
||||
options.flags = sl::DLSSGFlags::eRetainResourcesWhenOff;
|
||||
const sl::Result result = slDLSSGSetOptions(g_qd3d12Sl.viewport, options);
|
||||
if (result != sl::Result::eOk)
|
||||
QD3D12_Log("slDLSSGSetOptions(off) failed (%d).", int(result));
|
||||
if (g_qd3d12Sl.deviceBound && g_qd3d12Sl.dlssGSupported && g_qd3d12Sl.dlssGActive)
|
||||
{
|
||||
sl::DLSSGOptions options{};
|
||||
options.mode = sl::DLSSGMode::eOff;
|
||||
options.flags = sl::DLSSGFlags::eRetainResourcesWhenOff;
|
||||
const sl::Result result = slDLSSGSetOptions(g_qd3d12Sl.viewport, options);
|
||||
if (result != sl::Result::eOk)
|
||||
QD3D12_Log("slDLSSGSetOptions(off) failed (%d).", int(result));
|
||||
}
|
||||
|
||||
if (g_qd3d12Sl.reflexSupported)
|
||||
{
|
||||
@@ -7237,6 +7242,7 @@ static void QD3D12_SetDLSSFrameGenerationOff()
|
||||
}
|
||||
|
||||
g_qd3d12Sl.dlssGActive = false;
|
||||
g_qd3d12Sl.dlssGActiveFrameMultiplier = 1;
|
||||
g_qd3d12Sl.dlssGConfiguredFramesToGenerate = 0xffffffffu;
|
||||
g_qd3d12Sl.dlssGConfiguredRenderWidth = 0xffffffffu;
|
||||
g_qd3d12Sl.dlssGConfiguredRenderHeight = 0xffffffffu;
|
||||
@@ -7421,6 +7427,7 @@ static void QD3D12_ConfigureDLSSFrameGeneration(QD3D12Window& w, sl::FrameToken*
|
||||
}
|
||||
|
||||
g_qd3d12Sl.dlssGActive = true;
|
||||
g_qd3d12Sl.dlssGActiveFrameMultiplier = options.numFramesToGenerate + 1;
|
||||
}
|
||||
|
||||
static void QD3D12_LogDLSSFrameGenerationPresentResult()
|
||||
@@ -7537,6 +7544,13 @@ static void QD3D12_SelectRenderResolution(QD3D12Window& w, UINT outputWidth, UIN
|
||||
w.renderWidth = outputWidth;
|
||||
w.renderHeight = outputHeight;
|
||||
|
||||
if (outputWidth == 0 || outputHeight == 0)
|
||||
{
|
||||
w.renderWidth = 1;
|
||||
w.renderHeight = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_gl.upscalerBackend == QD3D12_UPSCALER_NONE || g_gl.upscalerQuality == QD3D12_QUALITY_NATIVE)
|
||||
return;
|
||||
|
||||
@@ -13154,6 +13168,19 @@ void APIENTRY glSpecularMapStrengthf(GLfloat strength)
|
||||
g_gl.currentSpecularMapStrength = (strength < 0.0f) ? 0.0f : strength;
|
||||
}
|
||||
|
||||
void APIENTRY glTextureAverageColorQD3D12(GLuint texture, GLfloat r, GLfloat g, GLfloat b, GLfloat a)
|
||||
{
|
||||
if (texture == 0)
|
||||
return;
|
||||
|
||||
TextureResource& tex = QD3D12_EnsureTextureName(texture);
|
||||
tex.averageColor[0] = ClampValue<float>(r, 0.0f, 1.0f);
|
||||
tex.averageColor[1] = ClampValue<float>(g, 0.0f, 1.0f);
|
||||
tex.averageColor[2] = ClampValue<float>(b, 0.0f, 1.0f);
|
||||
tex.averageColor[3] = ClampValue<float>(a, 0.0f, 1.0f);
|
||||
tex.cpuGeneration++;
|
||||
}
|
||||
|
||||
void APIENTRY glRaytracingMaterialFlagsQD3D12(GLuint flags)
|
||||
{
|
||||
g_gl.currentRayMaterialFlags = QD3D12_ClampRayMaterialFlags((uint32_t)flags);
|
||||
@@ -17237,6 +17264,15 @@ int QD3D12_GetFrameGenerationMultiplier(void)
|
||||
return (int)g_gl.frameGenerationMultiplier;
|
||||
}
|
||||
|
||||
int QD3D12_GetActiveFrameGenerationMultiplier(void)
|
||||
{
|
||||
#if defined(QD3D12_ENABLE_STREAMLINE)
|
||||
if (g_qd3d12Sl.dlssGActive && g_qd3d12Sl.dlssGActiveFrameMultiplier >= 2)
|
||||
return (int)g_qd3d12Sl.dlssGActiveFrameMultiplier;
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
void QD3D12_EnableDLAA(int enabled)
|
||||
{
|
||||
const QD3D12UpscalerBackend oldBackend = g_gl.upscalerBackend;
|
||||
@@ -18818,6 +18854,11 @@ void glUpdateBottomAccelStructure(bool opaque, uint32_t& meshHandle)
|
||||
meshDesc.indices = &drawIndexes[0];
|
||||
meshDesc.indexCount = (uint32_t)drawIndexes.size();
|
||||
meshDesc.allowUpdate = 1;
|
||||
meshDesc.averageColor[0] = meshDesc.averageColor[1] = meshDesc.averageColor[2] = meshDesc.averageColor[3] = 1.0f;
|
||||
|
||||
TextureResource* diffuseTexture = QD3D12_FindTextureResource(g_gl.boundTexture[0]);
|
||||
if (diffuseTexture)
|
||||
memcpy(meshDesc.averageColor, diffuseTexture->averageColor, sizeof(meshDesc.averageColor));
|
||||
|
||||
const uint32_t materialFlags = QD3D12_CurrentEffectiveRayMaterialFlags();
|
||||
const bool isGlass = QD3D12_RayMaterialFlagsHaveGlass(materialFlags);
|
||||
@@ -18836,6 +18877,12 @@ void glUpdateBottomAccelStructure(bool opaque, uint32_t& meshHandle)
|
||||
{
|
||||
g_qd3d12RaytracingMeshMaterialFlags[meshHandle] = materialFlags;
|
||||
glRaytracingSetMeshMaterialFlags((glRaytracingMeshHandle_t)meshHandle, materialFlags);
|
||||
glRaytracingSetMeshAverageColor(
|
||||
(glRaytracingMeshHandle_t)meshHandle,
|
||||
meshDesc.averageColor[0],
|
||||
meshDesc.averageColor[1],
|
||||
meshDesc.averageColor[2],
|
||||
meshDesc.averageColor[3]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user