Skip to content

Commit 4e851be

Browse files
committed
Merge branch 'master' into for-0.56.0/sync
2 parents b10c9c2 + 4ee12e1 commit 4e851be

17 files changed

+211
-440
lines changed

cmake/DaemonFlags.cmake

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -170,23 +170,26 @@ endif()
170170

171171
# Compiler options
172172
option(USE_FLOAT_EXCEPTIONS "Use floating point exceptions with common.floatException.* cvars" OFF)
173-
option(USE_FAST_MATH "Use fast math" ON)
173+
option(USE_FAST_MATH "Use fast math" OFF)
174174

175175
if (USE_FLOAT_EXCEPTIONS)
176-
add_definitions(-DDAEMON_USE_FLOAT_EXCEPTIONS)
176+
add_definitions(-DDAEMON_USE_FLOAT_EXCEPTIONS)
177177
endif()
178178

179179
if (MSVC)
180180
set_c_cxx_flag("/MP")
181181

182-
if (USE_FLOAT_EXCEPTIONS)
183-
set_c_cxx_flag("/fp:strict")
184-
# Don't switch on C4305 "truncation from 'double' to 'float'" every
185-
# time an unsuffixed decimal constant is used
186-
set_c_cxx_flag("/wd4305")
187-
elseif (USE_FAST_MATH)
188-
set_c_cxx_flag("/fp:fast")
189-
endif()
182+
if (USE_FAST_MATH)
183+
set_c_cxx_flag("/fp:fast")
184+
else()
185+
# Don't switch on C4305 "truncation from 'double' to 'float'" every
186+
# time an unsuffixed decimal constant is used
187+
set_c_cxx_flag("/wd4305")
188+
endif()
189+
190+
if (USE_FLOAT_EXCEPTIONS)
191+
set_c_cxx_flag("/fp:strict")
192+
endif()
190193

191194
set_c_cxx_flag("/d2Zi+" RELWITHDEBINFO)
192195

@@ -420,9 +423,13 @@ else()
420423
# Saigo NaCl compiler doesn't support LTO, the flag is accepted but linking fails
421424
# with “unable to pass LLVM bit-code files to linker” error.
422425
if (USE_LTO AND NOT NACL)
423-
try_c_cxx_flag(LTO "-flto")
426+
try_c_cxx_flag(LTO_AUTO "-flto=auto")
427+
428+
if (NOT FLAG_LTO_AUTO)
429+
try_c_cxx_flag(LTO "-flto")
430+
endif()
424431

425-
if (FLAG_LTO)
432+
if (FLAG_LTO_AUTO OR FLAG_LTO)
426433
# Pass all compile flags to the linker.
427434
set_linker_flag("${CMAKE_CXX_FLAGS}")
428435

src.cmake

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ set(GLSLSOURCELIST
147147
${ENGINE_DIR}/renderer/glsl_source/cull_cp.glsl
148148
${ENGINE_DIR}/renderer/glsl_source/depthReduction_cp.glsl
149149
${ENGINE_DIR}/renderer/glsl_source/processSurfaces_cp.glsl
150+
${ENGINE_DIR}/renderer/glsl_source/material_cp.glsl
150151
${ENGINE_DIR}/renderer/glsl_source/material_vp.glsl
151152
${ENGINE_DIR}/renderer/glsl_source/material_fp.glsl
152153
${ENGINE_DIR}/renderer/glsl_source/skybox_vp.glsl
@@ -169,8 +170,6 @@ set(GLSLSOURCELIST
169170
${ENGINE_DIR}/renderer/glsl_source/depthtile1_vp.glsl
170171
${ENGINE_DIR}/renderer/glsl_source/depthtile2_fp.glsl
171172
${ENGINE_DIR}/renderer/glsl_source/depthtile2_vp.glsl
172-
${ENGINE_DIR}/renderer/glsl_source/dispersion_C_fp.glsl
173-
${ENGINE_DIR}/renderer/glsl_source/dispersion_C_vp.glsl
174173
${ENGINE_DIR}/renderer/glsl_source/fogGlobal_fp.glsl
175174
${ENGINE_DIR}/renderer/glsl_source/fogGlobal_vp.glsl
176175
${ENGINE_DIR}/renderer/glsl_source/fogQuake3_fp.glsl
@@ -196,8 +195,6 @@ set(GLSLSOURCELIST
196195
${ENGINE_DIR}/renderer/glsl_source/portal_vp.glsl
197196
${ENGINE_DIR}/renderer/glsl_source/reflection_CB_fp.glsl
198197
${ENGINE_DIR}/renderer/glsl_source/reflection_CB_vp.glsl
199-
${ENGINE_DIR}/renderer/glsl_source/refraction_C_fp.glsl
200-
${ENGINE_DIR}/renderer/glsl_source/refraction_C_vp.glsl
201198
${ENGINE_DIR}/renderer/glsl_source/reliefMapping_fp.glsl
202199
${ENGINE_DIR}/renderer/glsl_source/screen_fp.glsl
203200
${ENGINE_DIR}/renderer/glsl_source/screen_vp.glsl

src/engine/renderer/Material.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,9 +1604,11 @@ void MaterialSystem::UpdateDynamicSurfaces() {
16041604

16051605
void MaterialSystem::UpdateFrameData() {
16061606
atomicCommandCountersBuffer.BindBufferBase( GL_SHADER_STORAGE_BUFFER, Util::ordinal( BufferBind::COMMAND_COUNTERS_STORAGE ) );
1607+
16071608
gl_clearSurfacesShader->BindProgram( 0 );
16081609
gl_clearSurfacesShader->SetUniform_Frame( nextFrame );
16091610
gl_clearSurfacesShader->DispatchCompute( MAX_VIEWS, 1, 1 );
1611+
16101612
atomicCommandCountersBuffer.UnBindBufferBase( GL_SHADER_STORAGE_BUFFER, Util::ordinal( BufferBind::COMMAND_COUNTERS_STORAGE ) );
16111613

16121614
GL_CheckErrors();
@@ -1774,11 +1776,8 @@ void MaterialSystem::StartFrame() {
17741776
if ( !generatedWorldCommandBuffer ) {
17751777
return;
17761778
}
1779+
17771780
frames[nextFrame].viewCount = 0;
1778-
1779-
// renderedMaterials.clear();
1780-
// UpdateDynamicSurfaces();
1781-
// UpdateFrameData();
17821781
}
17831782

17841783
void MaterialSystem::EndFrame() {
@@ -2059,7 +2058,6 @@ void MaterialSystem::RenderMaterials( const shaderSort_t fromSort, const shaderS
20592058
renderedMaterials.clear();
20602059
UpdateDynamicSurfaces();
20612060
UpdateFrameData();
2062-
// StartFrame();
20632061

20642062
// Make sure compute dispatches from the last frame finished writing to memory
20652063
glMemoryBarrier( GL_COMMAND_BARRIER_BIT );

src/engine/renderer/glsl_source/common_cp.glsl

Lines changed: 5 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -54,41 +54,9 @@ array must be in the form of uvec4 array[] */
5454
+ gl_GlobalInvocationID.y * gl_NumWorkGroups.x * gl_WorkGroupSize.x\
5555
+ gl_GlobalInvocationID.x )
5656

57-
/* Common structs */
57+
/* Macro combinations for subgroup ops */
5858

59-
struct BoundingSphere {
60-
vec3 origin;
61-
float radius;
62-
};
63-
64-
struct SurfaceDescriptor {
65-
BoundingSphere boundingSphere;
66-
uint surfaceCommandIDs[MAX_SURFACE_COMMANDS];
67-
};
68-
69-
struct PortalSurface {
70-
BoundingSphere boundingSphere;
71-
72-
uint drawSurfID;
73-
float distance;
74-
vec2 padding;
75-
};
76-
77-
struct GLIndirectCommand {
78-
uint count;
79-
uint instanceCount;
80-
uint firstIndex;
81-
int baseVertex;
82-
uint baseInstance;
83-
};
84-
85-
struct IndirectCompactCommand {
86-
uint count;
87-
uint firstIndex;
88-
uint baseInstance;
89-
};
90-
91-
struct SurfaceCommand {
92-
bool enabled;
93-
IndirectCompactCommand drawCommand;
94-
};
59+
#if defined(HAVE_KHR_shader_subgroup_basic) && defined(HAVE_KHR_shader_subgroup_arithmetic)\
60+
&& defined(HAVE_KHR_shader_subgroup_ballot) && defined(HAVE_ARB_shader_atomic_counter_ops)
61+
#define SUBGROUP_STREAM_COMPACTION
62+
#endif

src/engine/renderer/glsl_source/cull_cp.glsl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3535
/* cull_cp.glsl */
3636

3737
#insert common_cp
38+
#insert material_cp
3839

3940
// Keep this to 64 because we don't want extra shared mem etc. to be allocated, and to minimize wasted lanes
4041
layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in;

src/engine/renderer/glsl_source/dispersion_C_fp.glsl

Lines changed: 0 additions & 69 deletions
This file was deleted.

src/engine/renderer/glsl_source/dispersion_C_vp.glsl

Lines changed: 0 additions & 80 deletions
This file was deleted.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*
2+
===========================================================================
3+
4+
Daemon BSD Source Code
5+
Copyright (c) 2025 Daemon Developers
6+
All rights reserved.
7+
8+
This file is part of the Daemon BSD Source Code (Daemon Source Code).
9+
10+
Redistribution and use in source and binary forms, with or without
11+
modification, are permitted provided that the following conditions are met:
12+
* Redistributions of source code must retain the above copyright
13+
notice, this list of conditions and the following disclaimer.
14+
* Redistributions in binary form must reproduce the above copyright
15+
notice, this list of conditions and the following disclaimer in the
16+
documentation and/or other materials provided with the distribution.
17+
* Neither the name of the Daemon developers nor the
18+
names of its contributors may be used to endorse or promote products
19+
derived from this software without specific prior written permission.
20+
21+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24+
DISCLAIMED. IN NO EVENT SHALL DAEMON DEVELOPERS BE LIABLE FOR ANY
25+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+
32+
===========================================================================
33+
*/
34+
35+
/* material_cp.glsl */
36+
37+
struct BoundingSphere {
38+
vec3 origin;
39+
float radius;
40+
};
41+
42+
struct SurfaceDescriptor {
43+
BoundingSphere boundingSphere;
44+
uint surfaceCommandIDs[MAX_SURFACE_COMMANDS];
45+
};
46+
47+
struct PortalSurface {
48+
BoundingSphere boundingSphere;
49+
50+
uint drawSurfID;
51+
float distance;
52+
vec2 padding;
53+
};
54+
55+
struct GLIndirectCommand {
56+
uint count;
57+
uint instanceCount;
58+
uint firstIndex;
59+
int baseVertex;
60+
uint baseInstance;
61+
};
62+
63+
struct IndirectCompactCommand {
64+
uint count;
65+
uint firstIndex;
66+
uint baseInstance;
67+
};
68+
69+
struct SurfaceCommand {
70+
bool enabled;
71+
IndirectCompactCommand drawCommand;
72+
};

0 commit comments

Comments
 (0)