A Shader Compile Error Occurs with Two AOV Outputs in a Specific Shader Node Configuration #115226

Closed
opened 2023-11-21 09:24:17 +01:00 by Takuma-Kudou · 4 comments

System Information
Operating system: Windows 11 Pro
Graphics card: NVIDIA GeForce RTX 3060

Blender Version
Broken: Blender 3.01 - Blender 4.0.1

Short description of error
The combination of a 3D noise texture's color output and a bump to generate a normal, connected to the Normal of a BSDF node, causes a shader compile error when the BSDF node output is connected to two AOV output nodes.

Exact steps for others to reproduce the error
Please refer to the attached blend file.

The key points are as follows:

  • Set the noise texture to 3D and connect its color output to the height of the bump.

  • Connect the bump's normal output to the normal input of the BSDF.

  • Configure the BSDF output to reach two AOV outputs."

image

**System Information** Operating system: Windows 11 Pro Graphics card: NVIDIA GeForce RTX 3060 **Blender Version** Broken: Blender 3.01 - Blender 4.0.1 **Short description of error** The combination of a 3D noise texture's color output and a bump to generate a normal, connected to the Normal of a BSDF node, causes a shader compile error when the BSDF node output is connected to two AOV output nodes. **Exact steps for others to reproduce the error** Please refer to the attached blend file. The key points are as follows: - Set the noise texture to 3D and connect its color output to the height of the bump. - Connect the bump's normal output to the normal input of the BSDF. - Configure the BSDF output to reach two AOV outputs." ![image](/attachments/2608d01a-8f29-40a5-bcaf-afcfafb6c780)
Takuma-Kudou added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-11-21 09:24:18 +01:00
Member

Hi, thanks for the report. This shader is complied correctly in 3.3 and prior versions. Raising the priority for awareness. I'll bisect.

Hi, thanks for the report. This shader is complied correctly in 3.3 and prior versions. Raising the priority for awareness. I'll bisect.
Member

Broke between 909f47e0e1 and 7a6cdeb242

ERROR (gpu.shader): GPU_material_compile Linking: 
      | Fragment info
      | -------------
      | C7050: "out_aov" might be used before being initialized
Broke between 909f47e0e197 and 7a6cdeb24279 ``` ERROR (gpu.shader): GPU_material_compile Linking: | Fragment info | ------------- | C7050: "out_aov" might be used before being initialized ```
Member

Note that the relevant part of the error is this one:

      | Internal error: assembly compile error for fragment shader at offset 1632592:
      | -- error message --
      | line 65847, column 1:  error: too many instructions
      | -- internal assembly text --

Reverting a84c92fc73 seems to fix it, however, I really don't understand why.
While the generated code is still far from optimal, that commit only removes death code.

This is what the diff between the generated code after that commit looks like:

diff --git a/before.glsl b/after.glsl
index 84d04ad..e6ca3a6 100644
--- a/before.glsl.c
+++ b/after.glsl.c
@@ -127,52 +127,10 @@ node_noise_tex_fbm_3d(tmp10, node_tree.u12, node_tree.u13, node_tree.u14, node_t
 float tmp25;
 set_value(float_from_vec4(tmp22), tmp25);
 
-vec3 tmp71;
-differentiate_texco(var_attrs.v0, tmp71);
-
-vec3 tmp79;
-mapping_mat4(tmp71, node_tree.u73, node_tree.u74, node_tree.u75, node_tree.u76, node_tree.u77, node_tree.u78, tmp79);
-
-float cons89 = float(uintBitsToFloat(1065353216u));
-float tmp90;
-vec4 tmp91;
-node_noise_tex_fbm_3d(tmp79, node_tree.u81, node_tree.u82, node_tree.u83, node_tree.u84, node_tree.u85, node_tree.u86, node_tree.u87, node_tree.u88, cons89, tmp90, tmp91);
-
-float tmp94;
-set_value(float_from_vec4(tmp91), tmp94);
-
-vec3 tmp145;
-differentiate_texco(var_attrs.v0, tmp145);
-
-vec3 tmp153;
-mapping_mat4(tmp145, node_tree.u147, node_tree.u148, node_tree.u149, node_tree.u150, node_tree.u151, node_tree.u152, tmp153);
-
-float cons163 = float(uintBitsToFloat(1065353216u));
-float tmp164;
-vec4 tmp165;
-node_noise_tex_fbm_3d(tmp153, node_tree.u155, node_tree.u156, node_tree.u157, node_tree.u158, node_tree.u159, node_tree.u160, node_tree.u161, node_tree.u162, cons163, tmp164, tmp165);
-
-float tmp168;
-set_value(float_from_vec4(tmp165), tmp168);
-
 return tmp25;
 }
 
 float ntree_fn1() {
-vec3 tmp2;
-differentiate_texco(var_attrs.v0, tmp2);
-
-vec3 tmp10;
-mapping_mat4(tmp2, node_tree.u4, node_tree.u5, node_tree.u6, node_tree.u7, node_tree.u8, node_tree.u9, tmp10);
-
-float cons20 = float(uintBitsToFloat(1065353216u));
-float tmp21;
-vec4 tmp22;
-node_noise_tex_fbm_3d(tmp10, node_tree.u12, node_tree.u13, node_tree.u14, node_tree.u15, node_tree.u16, node_tree.u17, node_tree.u18, node_tree.u19, cons20, tmp21, tmp22);
-
-float tmp25;
-set_value(float_from_vec4(tmp22), tmp25);
-
 vec3 tmp71;
 differentiate_texco(var_attrs.v0, tmp71);
 
@@ -187,52 +145,10 @@ node_noise_tex_fbm_3d(tmp79, node_tree.u81, node_tree.u82, node_tree.u83, node_t
 float tmp94;
 set_value(float_from_vec4(tmp91), tmp94);
 
-vec3 tmp145;
-differentiate_texco(var_attrs.v0, tmp145);
-
-vec3 tmp153;
-mapping_mat4(tmp145, node_tree.u147, node_tree.u148, node_tree.u149, node_tree.u150, node_tree.u151, node_tree.u152, tmp153);
-
-float cons163 = float(uintBitsToFloat(1065353216u));
-float tmp164;
-vec4 tmp165;
-node_noise_tex_fbm_3d(tmp153, node_tree.u155, node_tree.u156, node_tree.u157, node_tree.u158, node_tree.u159, node_tree.u160, node_tree.u161, node_tree.u162, cons163, tmp164, tmp165);
-
-float tmp168;
-set_value(float_from_vec4(tmp165), tmp168);
-
 return tmp94;
 }
 
 float ntree_fn2() {
-vec3 tmp2;
-differentiate_texco(var_attrs.v0, tmp2);
-
-vec3 tmp10;
-mapping_mat4(tmp2, node_tree.u4, node_tree.u5, node_tree.u6, node_tree.u7, node_tree.u8, node_tree.u9, tmp10);
-
-float cons20 = float(uintBitsToFloat(1065353216u));
-float tmp21;
-vec4 tmp22;
-node_noise_tex_fbm_3d(tmp10, node_tree.u12, node_tree.u13, node_tree.u14, node_tree.u15, node_tree.u16, node_tree.u17, node_tree.u18, node_tree.u19, cons20, tmp21, tmp22);
-
-float tmp25;
-set_value(float_from_vec4(tmp22), tmp25);
-
-vec3 tmp71;
-differentiate_texco(var_attrs.v0, tmp71);
-
-vec3 tmp79;
-mapping_mat4(tmp71, node_tree.u73, node_tree.u74, node_tree.u75, node_tree.u76, node_tree.u77, node_tree.u78, tmp79);
-
-float cons89 = float(uintBitsToFloat(1065353216u));
-float tmp90;
-vec4 tmp91;
-node_noise_tex_fbm_3d(tmp79, node_tree.u81, node_tree.u82, node_tree.u83, node_tree.u84, node_tree.u85, node_tree.u86, node_tree.u87, node_tree.u88, cons89, tmp90, tmp91);
-
-float tmp94;
-set_value(float_from_vec4(tmp91), tmp94);
-
 vec3 tmp145;
 differentiate_texco(var_attrs.v0, tmp145);
Note that the relevant part of the error is this one: ``` | Internal error: assembly compile error for fragment shader at offset 1632592: | -- error message -- | line 65847, column 1: error: too many instructions | -- internal assembly text -- ``` Reverting a84c92fc73 seems to fix it, however, I really don't understand why. While the generated code is still far from optimal, that commit only removes death code. This is what the diff between the generated code after that commit looks like: ```diff diff --git a/before.glsl b/after.glsl index 84d04ad..e6ca3a6 100644 --- a/before.glsl.c +++ b/after.glsl.c @@ -127,52 +127,10 @@ node_noise_tex_fbm_3d(tmp10, node_tree.u12, node_tree.u13, node_tree.u14, node_t float tmp25; set_value(float_from_vec4(tmp22), tmp25); -vec3 tmp71; -differentiate_texco(var_attrs.v0, tmp71); - -vec3 tmp79; -mapping_mat4(tmp71, node_tree.u73, node_tree.u74, node_tree.u75, node_tree.u76, node_tree.u77, node_tree.u78, tmp79); - -float cons89 = float(uintBitsToFloat(1065353216u)); -float tmp90; -vec4 tmp91; -node_noise_tex_fbm_3d(tmp79, node_tree.u81, node_tree.u82, node_tree.u83, node_tree.u84, node_tree.u85, node_tree.u86, node_tree.u87, node_tree.u88, cons89, tmp90, tmp91); - -float tmp94; -set_value(float_from_vec4(tmp91), tmp94); - -vec3 tmp145; -differentiate_texco(var_attrs.v0, tmp145); - -vec3 tmp153; -mapping_mat4(tmp145, node_tree.u147, node_tree.u148, node_tree.u149, node_tree.u150, node_tree.u151, node_tree.u152, tmp153); - -float cons163 = float(uintBitsToFloat(1065353216u)); -float tmp164; -vec4 tmp165; -node_noise_tex_fbm_3d(tmp153, node_tree.u155, node_tree.u156, node_tree.u157, node_tree.u158, node_tree.u159, node_tree.u160, node_tree.u161, node_tree.u162, cons163, tmp164, tmp165); - -float tmp168; -set_value(float_from_vec4(tmp165), tmp168); - return tmp25; } float ntree_fn1() { -vec3 tmp2; -differentiate_texco(var_attrs.v0, tmp2); - -vec3 tmp10; -mapping_mat4(tmp2, node_tree.u4, node_tree.u5, node_tree.u6, node_tree.u7, node_tree.u8, node_tree.u9, tmp10); - -float cons20 = float(uintBitsToFloat(1065353216u)); -float tmp21; -vec4 tmp22; -node_noise_tex_fbm_3d(tmp10, node_tree.u12, node_tree.u13, node_tree.u14, node_tree.u15, node_tree.u16, node_tree.u17, node_tree.u18, node_tree.u19, cons20, tmp21, tmp22); - -float tmp25; -set_value(float_from_vec4(tmp22), tmp25); - vec3 tmp71; differentiate_texco(var_attrs.v0, tmp71); @@ -187,52 +145,10 @@ node_noise_tex_fbm_3d(tmp79, node_tree.u81, node_tree.u82, node_tree.u83, node_t float tmp94; set_value(float_from_vec4(tmp91), tmp94); -vec3 tmp145; -differentiate_texco(var_attrs.v0, tmp145); - -vec3 tmp153; -mapping_mat4(tmp145, node_tree.u147, node_tree.u148, node_tree.u149, node_tree.u150, node_tree.u151, node_tree.u152, tmp153); - -float cons163 = float(uintBitsToFloat(1065353216u)); -float tmp164; -vec4 tmp165; -node_noise_tex_fbm_3d(tmp153, node_tree.u155, node_tree.u156, node_tree.u157, node_tree.u158, node_tree.u159, node_tree.u160, node_tree.u161, node_tree.u162, cons163, tmp164, tmp165); - -float tmp168; -set_value(float_from_vec4(tmp165), tmp168); - return tmp94; } float ntree_fn2() { -vec3 tmp2; -differentiate_texco(var_attrs.v0, tmp2); - -vec3 tmp10; -mapping_mat4(tmp2, node_tree.u4, node_tree.u5, node_tree.u6, node_tree.u7, node_tree.u8, node_tree.u9, tmp10); - -float cons20 = float(uintBitsToFloat(1065353216u)); -float tmp21; -vec4 tmp22; -node_noise_tex_fbm_3d(tmp10, node_tree.u12, node_tree.u13, node_tree.u14, node_tree.u15, node_tree.u16, node_tree.u17, node_tree.u18, node_tree.u19, cons20, tmp21, tmp22); - -float tmp25; -set_value(float_from_vec4(tmp22), tmp25); - -vec3 tmp71; -differentiate_texco(var_attrs.v0, tmp71); - -vec3 tmp79; -mapping_mat4(tmp71, node_tree.u73, node_tree.u74, node_tree.u75, node_tree.u76, node_tree.u77, node_tree.u78, tmp79); - -float cons89 = float(uintBitsToFloat(1065353216u)); -float tmp90; -vec4 tmp91; -node_noise_tex_fbm_3d(tmp79, node_tree.u81, node_tree.u82, node_tree.u83, node_tree.u84, node_tree.u85, node_tree.u86, node_tree.u87, node_tree.u88, cons89, tmp90, tmp91); - -float tmp94; -set_value(float_from_vec4(tmp91), tmp94); - vec3 tmp145; differentiate_texco(var_attrs.v0, tmp145); ```
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2023-12-22 17:32:38 +01:00
Member

I still don't know why the Nvidia compiler freaks out after removing dead code, but I've pushed an improvement for AOVs that further optimizes the generated code and seems to do the trick. 🤷‍♂️

I still don't know why the Nvidia compiler freaks out after removing dead code, but I've pushed an improvement for AOVs that further optimizes the generated code and seems to do the trick. 🤷‍♂️
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#115226
No description provided.