Skip to content

Commit

Permalink
Merge branch 'main' into bjd/agx
Browse files Browse the repository at this point in the history
  • Loading branch information
bejado authored Oct 13, 2023
2 parents d31a5b2 + 078a174 commit 60878a7
Show file tree
Hide file tree
Showing 173 changed files with 16,200 additions and 18,288 deletions.
1 change: 1 addition & 0 deletions NEW_RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ appropriate header in [RELEASE_NOTES.md](./RELEASE_NOTES.md).
- engine: Added parameter for configuring JobSystem thread count
- engine: In Java, introduce Engine.Builder
- engine: New tone mapper: `AgXTonemapper`.
- matinfo: Add support for viewing ESSL 1.0 shaders
2 changes: 1 addition & 1 deletion filament/src/PerShadowMapUniforms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void PerShadowMapUniforms::prepareCamera(Transaction const& transaction,
s.clipFromWorldMatrix[0] = clipFromWorld; // projection * view
s.worldFromClipMatrix = worldFromClip; // 1/(projection * view)
s.userWorldFromWorldMatrix = mat4f(inverse(camera.worldOrigin));
s.clipTransform = camera.clipTransfrom;
s.clipTransform = camera.clipTransform;
s.cameraFar = camera.zf;
s.oneOverFarMinusNear = 1.0f / (camera.zf - camera.zn);
s.nearOverFarMinusNear = camera.zn / (camera.zf - camera.zn);
Expand Down
2 changes: 1 addition & 1 deletion filament/src/PerViewUniforms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void PerViewUniforms::prepareCamera(FEngine& engine, const CameraInfo& camera) n
s.viewFromClipMatrix = viewFromClip; // 1/projection
s.worldFromClipMatrix = worldFromClip; // 1/(projection * view)
s.userWorldFromWorldMatrix = mat4f(inverse(camera.worldOrigin));
s.clipTransform = camera.clipTransfrom;
s.clipTransform = camera.clipTransform;
s.cameraFar = camera.zf;
s.oneOverFarMinusNear = 1.0f / (camera.zf - camera.zn);
s.nearOverFarMinusNear = camera.zn / (camera.zf - camera.zn);
Expand Down
2 changes: 1 addition & 1 deletion filament/src/PostProcessManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2503,7 +2503,7 @@ void PostProcessManager::prepareTaa(FrameGraph& fg, filament::Viewport const& sv
inoutCameraInfo->projection[2].xy -= jitterInClipSpace;
// VERTEX_DOMAIN_DEVICE doesn't apply the projection, but it still needs this
// clip transform, so we apply it separately (see main.vs)
inoutCameraInfo->clipTransfrom.zw -= jitterInClipSpace;
inoutCameraInfo->clipTransform.zw -= jitterInClipSpace;

fg.addTrivialSideEffectPass("Jitter Camera",
[=, &uniforms] (DriverApi& driver) {
Expand Down
2 changes: 1 addition & 1 deletion filament/src/details/Camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ struct CameraInfo {
math::mat4f eyeFromView[CONFIG_STEREOSCOPIC_EYES]; // eye view matrix (only for stereoscopic)
math::mat4 worldOrigin; // world origin transform (already applied
// to model and view)
math::float4 clipTransfrom{1, 1, 0, 0}; // clip-space transform, only for VERTEX_DOMAIN_DEVICE
math::float4 clipTransform{1, 1, 0, 0}; // clip-space transform, only for VERTEX_DOMAIN_DEVICE
float zn{}; // distance (positive) to the near plane
float zf{}; // distance (positive) to the far plane
float ev100{}; // exposure
Expand Down
2 changes: 1 addition & 1 deletion filament/src/details/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ void FRenderer::renderJob(ArenaScope& arena, FView& view) {

// VERTEX_DOMAIN_DEVICE doesn't apply the projection, but it still needs this
// clip transform, so we apply it separately (see main.vs)
cameraInfo.clipTransfrom = { ts[0][0], ts[1][1], ts[3].x, ts[3].y };
cameraInfo.clipTransform = { ts[0][0], ts[1][1], ts[3].x, ts[3].y };

// adjust svp to the new, larger, rendering dimensions
svp.width = uint32_t(width);
Expand Down
11 changes: 1 addition & 10 deletions libs/filamat/src/GLSLPostProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,23 +487,14 @@ void GLSLPostProcessor::fullOptimization(const TShader& tShader,
// Compile GLSL to to SPIR-V
SpvOptions options;
options.generateDebugInfo = mGenerateDebugInfo;
// This step is required for what we attempt later using spirvbin_t::remap()
if (!internalConfig.spirvOutput && optimizeForSize) {
options.emitNonSemanticShaderDebugInfo = true;
}
GlslangToSpv(*tShader.getIntermediate(), spirv, &options);

if (internalConfig.spirvOutput) {
// Run the SPIR-V optimizer
OptimizerPtr const optimizer = createOptimizer(mOptimization, config);
optimizeSpirv(optimizer, spirv);
} else {
// When we optimize for size, and we generate text-based shaders, we save much more
// by preserving variable names and running a simple DCE pass instead of using spirv-opt
if (optimizeForSize) {
spv::spirvbin_t(0).remap(
spirv, {}, spv::spirvbin_t::DCE_ALL | spv::spirvbin_t::OPT_ALL);
} else {
if (!optimizeForSize) {
OptimizerPtr const optimizer = createOptimizer(mOptimization, config);
optimizeSpirv(optimizer, spirv);
}
Expand Down
3 changes: 2 additions & 1 deletion libs/matdbg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ set(PUBLIC_HDRS
)

set(SRCS
src/ApiHandler.cpp
src/ApiHandler.h
src/CommonWriter.h
src/CommonWriter.cpp
src/DebugServer.cpp
Expand Down Expand Up @@ -59,7 +61,6 @@ endif()
set(DUMMY_SRC "${RESOURCE_DIR}/dummy.c")
add_custom_command(OUTPUT ${DUMMY_SRC} COMMAND echo "//" > ${DUMMY_SRC})


add_library(matdbg_resources ${DUMMY_SRC} ${RESGEN_SOURCE})
set_target_properties(matdbg_resources PROPERTIES FOLDER Libs)

Expand Down
33 changes: 17 additions & 16 deletions libs/matdbg/include/matdbg/DebugServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,19 @@

class CivetServer;

namespace filament {
namespace matdbg {
namespace filament::matdbg {

using MaterialKey = uint32_t;

struct MaterialRecord {
void* userdata;
const uint8_t* package;
size_t packageSize;
utils::CString name;
MaterialKey key;
VariantList activeVariants;
};

/**
* Server-side material debugger.
*
Expand All @@ -41,6 +49,9 @@ using MaterialKey = uint32_t;
*/
class DebugServer {
public:
static std::string_view const kSuccessHeader;
static std::string_view const kErrorHeader;

DebugServer(backend::Backend backend, int port);
~DebugServer();

Expand Down Expand Up @@ -74,16 +85,7 @@ class DebugServer {
bool isReady() const { return mServer; }

private:
struct MaterialRecord {
void* userdata;
const uint8_t* package;
size_t packageSize;
utils::CString name;
MaterialKey key;
VariantList activeVariants;
};

const MaterialRecord* getRecord(const MaterialKey& key) const;
MaterialRecord const* getRecord(const MaterialKey& key) const;

void updateActiveVariants();

Expand All @@ -109,15 +111,14 @@ class DebugServer {
QueryCallback mQueryCallback = nullptr;

class FileRequestHandler* mFileHandler = nullptr;
class RestRequestHandler* mRestHandler = nullptr;
class ApiHandler* mApiHandler = nullptr;
class WebSocketHandler* mWebSocketHandler = nullptr;

friend class FileRequestHandler;
friend class RestRequestHandler;
friend class ApiHandler;
friend class WebSocketHandler;
};

} // namespace matdbg
} // namespace filament
} // namespace filament::matdbg

#endif // MATDBG_DEBUGSERVER_H
2 changes: 1 addition & 1 deletion libs/matdbg/include/matdbg/ShaderExtractor.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace matdbg {
// in a manner similar to ShaderReplacer.
class ShaderExtractor {
public:
ShaderExtractor(backend::Backend backend, const void* data, size_t size);
ShaderExtractor(backend::ShaderLanguage target, const void* data, size_t size);
bool parse() noexcept;
bool getShader(backend::ShaderModel shaderModel,
Variant variant, backend::ShaderStage stage, filaflat::ShaderContent& shader) noexcept;
Expand Down
4 changes: 1 addition & 3 deletions libs/matdbg/include/matdbg/ShaderInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ struct ShaderInfo {
};

size_t getShaderCount(const filaflat::ChunkContainer& container, filamat::ChunkType type);
bool getMetalShaderInfo(const filaflat::ChunkContainer& container, ShaderInfo* info);
bool getGlShaderInfo(const filaflat::ChunkContainer& container, ShaderInfo* info);
bool getVkShaderInfo(const filaflat::ChunkContainer& container, ShaderInfo* info);
bool getShaderInfo(const filaflat::ChunkContainer& container, ShaderInfo* info, filamat::ChunkType chunkType);

} // namespace matdbg
} // namespace filament
Expand Down
Loading

0 comments on commit 60878a7

Please sign in to comment.