Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Shader Decompilation fails on Slime Rancher 2 #726

Open
MadMincraftr opened this issue Feb 7, 2023 · 13 comments · May be fixed by #1316
Open

[Bug]: Shader Decompilation fails on Slime Rancher 2 #726

MadMincraftr opened this issue Feb 7, 2023 · 13 comments · May be fixed by #1316
Labels
bug Something isn't working shaders

Comments

@MadMincraftr
Copy link

MadMincraftr commented Feb 7, 2023

Are you on the latest version of AssetRipper?

Yes, I'm on the latest release of AssetRipper.
edit: I forgot to update, I did, I still have the error

Which release are you using?

Windows x64

Which game did this occur on?

[Slime Rancher 2] (https://steamdb.info/app/1657630/)

Which Unity version did this occur on?

2021.2.10

Is the game Mono or IL2Cpp?

IL2Cpp

Describe the issue.

During export error messages started coming up in log, and the export stopped

Relevant log output

log too long to send: https://drive.google.com/file/d/1wzCkMdcMdT-WdfdKfBVpx2wPmyE2HNnH/view?usp=share_link

@MadMincraftr MadMincraftr added the bug Something isn't working label Feb 7, 2023
@ds5678
Copy link
Collaborator

ds5678 commented Feb 8, 2023

This is an issue with shader decompilation.

[Error] : System.InvalidOperationException: Sequence contains no matching element
   at System.Linq.ThrowHelper.ThrowNoMatchException()
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
   at AssetRipper.Export.Modules.Shaders.UltraShaderConverter.USIL.Metadders.USILCBufferMetadder.UseMetadata(USILOperand operand, ShaderSubProgram shaderData) in D:\a\AssetRipper\AssetRipper\Source\AssetRipper.Export.Modules.Shader\UltraShaderConverter\USIL\Metadders\USILCBufferMetadder.cs:line 43
   at AssetRipper.Export.Modules.Shaders.UltraShaderConverter.USIL.Metadders.USILCBufferMetadder.Run(UShaderProgram shader, ShaderSubProgram shaderData) in D:\a\AssetRipper\AssetRipper\Source\AssetRipper.Export.Modules.Shader\UltraShaderConverter\USIL\Metadders\USILCBufferMetadder.cs:line 21
   at AssetRipper.Export.Modules.Shaders.UltraShaderConverter.USIL.USILOptimizerApplier.Apply(UShaderProgram shader, ShaderSubProgram shaderData) in D:\a\AssetRipper\AssetRipper\Source\AssetRipper.Export.Modules.Shader\UltraShaderConverter\USIL\USILOptimizerApplier.cs:line 43
   at AssetRipper.Export.Modules.Shaders.UltraShaderConverter.Converter.USCShaderConverter.ApplyMetadataToProgram(ShaderSubProgram subProgram, UnityVersion version) in D:\a\AssetRipper\AssetRipper\Source\AssetRipper.Export.Modules.Shader\UltraShaderConverter\Converter\USCShaderConverter.cs:line 53
   at AssetRipper.Export.UnityProjects.Shaders.USCShaderExporter.ExportPassDecomp(ISerializedPass _this, ShaderWriter writer) in D:\a\AssetRipper\AssetRipper\Source\AssetRipper.Export.UnityProjects\Shaders\USCShaderExporter.cs:line 392
   at AssetRipper.Export.UnityProjects.Shaders.USCShaderExporter.ExportSubShaderDecomp(ISerializedSubShader _this, ShaderWriter writer) in D:\a\AssetRipper\AssetRipper\Source\AssetRipper.Export.UnityProjects\Shaders\USCShaderExporter.cs:line 157
   at AssetRipper.Export.UnityProjects.Shaders.USCShaderExporter.ExportSerializedShaderDecomp(ISerializedShader _this, ShaderWriter writer) in D:\a\AssetRipper\AssetRipper\Source\AssetRipper.Export.UnityProjects\Shaders\USCShaderExporter.cs:line 127
   at AssetRipper.Export.UnityProjects.Shaders.USCShaderExporter.ExportBinary(IShader shader, IExportContainer container, Stream stream, Func`3 exporterInstantiator) in D:\a\AssetRipper\AssetRipper\Source\AssetRipper.Export.UnityProjects\Shaders\USCShaderExporter.cs:line 91
   at AssetRipper.Export.UnityProjects.Shaders.USCShaderExporter.Export(IExportContainer container, IUnityObjectBase asset, String path) in D:\a\AssetRipper\AssetRipper\Source\AssetRipper.Export.UnityProjects\Shaders\USCShaderExporter.cs:line 51
   at AssetRipper.Export.UnityProjects.Project.Collections.AssetExportCollection.ExportInner(IProjectAssetContainer container, String filePath, String dirPath) in D:\a\AssetRipper\AssetRipper\Source\AssetRipper.Export.UnityProjects\Project\Collections\AssetExportCollection.cs:line 89
   at AssetRipper.Export.UnityProjects.Project.Collections.AssetExportCollection.Export(IProjectAssetContainer container, String projectDirectory) in D:\a\AssetRipper\AssetRipper\Source\AssetRipper.Export.UnityProjects\Project\Collections\AssetExportCollection.cs:line 48
   at AssetRipper.Export.UnityProjects.Project.ProjectExporter.Export(GameBundle fileCollection, IEnumerable`1 files, CoreConfiguration options) in D:\a\AssetRipper\AssetRipper\Source\AssetRipper.Export.UnityProjects\Project\ProjectExporter.cs:line 271
   at AssetRipper.Export.UnityProjects.Project.ProjectExporter.Export(GameBundle fileCollection, CoreConfiguration options) in D:\a\AssetRipper\AssetRipper\Source\AssetRipper.Export.UnityProjects\Project\ProjectExporter.cs:line 177
   at AssetRipper.Export.UnityProjects.Ripper.ExportProject(String exportPath, Func`2 filter, Action`1 onBeforeExport) in D:\a\AssetRipper\AssetRipper\Source\AssetRipper.Export.UnityProjects\Ripper.cs:line 174
   at AssetRipper.Export.UnityProjects.Ripper.ExportProject(String exportPath, Action`1 onBeforeExport) in D:\a\AssetRipper\AssetRipper\Source\AssetRipper.Export.UnityProjects\Ripper.cs:line 155
   at AssetRipper.GUI.Managers.UIExportManager.ExportInternal(Ripper ripper, MainWindowViewModel vm, String toRoot, Action onSuccess, Action`1 onError) in D:\a\AssetRipper\AssetRipper\Source\AssetRipper.GUI\Managers\UIExportManager.cs:line 49

@ds5678 ds5678 added the shaders label Feb 8, 2023
@ds5678 ds5678 changed the title Sequence contains no matching element [Bug]: Shader Decompilation fails on Slime Rancher 2 Feb 8, 2023
@ds5678
Copy link
Collaborator

ds5678 commented Apr 26, 2023

Shader decompilation is experimental and bugs are to be expected. Most of the contributors, including myself, have higher priorities at the moment, so this might not be investigated for a long time. If you're able, I encourage you to investigate the issue and contribute a pull request with improvements.

@RealCA
Copy link

RealCA commented Aug 28, 2023

I dont know if u found a fix.

That error occurs when the shadersubprogram dosent have bindings.
Most likely the bindings will be under common properties

Screenshot (6)
Screenshot (4)

I did a dirty fix for this.
Yes as dirty as my explanation.

If u dont understand, well not that I ever expect anything Iv written to make sence. ill update a fork of this project with changes.

If u still have issues let me know with error log Im happy to help...

File name : USCShaderExporter.cs

private static void ExportSubShaderDecomp(ISerializedSubShader _this, ShaderWriter writer)
   	{
   		writer.WriteIndent(1);
   		writer.Write("SubShader {\n");
   		if (_this.LOD != 0)
   		{
   			writer.WriteIndent(2);
   			writer.Write($"LOD {_this.LOD}\n");
   		}
   		_this.Tags.Export(writer, 2);
   		for (int i = 0; i < _this.Passes.Count; i++)
   		{
   			ExportPassDecomp(_this.Passes[i], writer);
   		}
   		writer.WriteIndent(1);
   		writer.Write("}\n");
   	}

   	private static void ExportPassDecomp(ISerializedPass _this, ShaderWriter writer)
   	{
   		writer.WriteIndent(2);
   		writer.Write($"{(SerializedPassType)_this.Type} ");

   		if ((SerializedPassType)_this.Type == SerializedPassType.UsePass)
   		{
   			writer.Write($"\"{_this.UseName}\"\n");
   		}
   		else
   		{
   			writer.Write("{\n");

   			if ((SerializedPassType)_this.Type == SerializedPassType.GrabPass)
   			{
   				if (_this.TextureName.Data.Length > 0)
   				{
   					writer.WriteIndent(3);
   					writer.Write($"\"{_this.TextureName}\"\n");
   				}
   			}
   			else if ((SerializedPassType)_this.Type == SerializedPassType.Pass)
   			{
   				_this.State.Export(writer);

   				bool hasVertex = (_this.ProgramMask & ShaderType.Vertex.ToProgramMask()) != 0;
   				bool hasFragment = (_this.ProgramMask & ShaderType.Fragment.ToProgramMask()) != 0;

   				List<ShaderSubProgram>? vertexSubPrograms = null;
   				List<ShaderSubProgram>? fragmentSubPrograms = null;

   				if (hasVertex)
   				{
   					vertexSubPrograms = GetSubPrograms(writer.Shader, writer.Blobs, _this.ProgVertex, writer.Version, writer.Platform, ShaderType.Vertex, _this);
   					if (vertexSubPrograms.Count == 0)
   					{
   						writer.WriteIndent(3);
   						writer.Write("// No subprograms found\n");
   						writer.WriteIndent(2);
   						writer.Write("}\n");
   						return;
   					}
   				}
   				if (hasFragment)
   				{
   					fragmentSubPrograms = GetSubPrograms(writer.Shader, writer.Blobs, _this.ProgFragment, writer.Version, writer.Platform, ShaderType.Fragment, _this);
   					if (fragmentSubPrograms.Count == 0)
   					{
   						writer.WriteIndent(3);
   						writer.Write("// No subprograms found\n");
   						writer.WriteIndent(2);
   						writer.Write("}\n");
   						return;
   					}
   				}

   				ShaderSubProgram? vertexSubProgram = null;
   				ShaderSubProgram? fragmentSubProgram = null;
   				USCShaderConverter? vertexConverter = null;
   				USCShaderConverter? fragmentConverter = null;

   				if (hasVertex)
   				{
   					vertexSubProgram = vertexSubPrograms![0];

   					byte[] trimmedProgramData = TrimShaderBytes(vertexSubProgram, writer.Version, writer.Platform);

   					vertexConverter = new USCShaderConverter();
   					vertexConverter.LoadDirectXCompiledShader(new MemoryStream(trimmedProgramData));
   				}
   				if (hasFragment)
   				{
   					fragmentSubProgram = fragmentSubPrograms![0];

   					byte[] trimmedProgramData = TrimShaderBytes(fragmentSubProgram, writer.Version, writer.Platform);

   					fragmentConverter = new USCShaderConverter();
   					fragmentConverter.LoadDirectXCompiledShader(new MemoryStream(trimmedProgramData));
   				}

   				writer.WriteIndent(3);
   				writer.WriteLine("CGPROGRAM");

   				if (hasVertex)
   				{
   					writer.WriteIndent(3);
   					writer.WriteLine("#pragma vertex vert");
   				}
   				if (hasFragment)
   				{
   					writer.WriteIndent(3);
   					writer.WriteLine("#pragma fragment frag");
   				}
   				if (hasVertex || hasFragment)
   				{
   					writer.WriteIndent(3);
   					writer.WriteLine("");
   				}

   				writer.WriteIndent(3);
   				writer.WriteLine("#include \"UnityCG.cginc\"");

   				if (hasVertex)
   				{
   					// v2f struct (vert output/frag input)
   					writer.WriteIndent(3);
   					writer.WriteLine($"struct {USILConstants.VERT_TO_FRAG_STRUCT_NAME}");
   					writer.WriteIndent(3);
   					writer.WriteLine("{");

   					DirectXCompiledShader? dxShader = vertexConverter!.DxShader;
   					Debug.Assert(dxShader != null);
   					foreach (OSGN.Output output in dxShader.Osgn.outputs)
   					{
   						string format = DXShaderNamingUtils.GetOSGNFormatName(output);
   						string type = output.name + output.index;
   						string name = DXShaderNamingUtils.GetOSGNOutputName(output);

   						writer.WriteIndent(4);
   						writer.WriteLine($"{format} {name} : {type};");
   					}

   					writer.WriteIndent(3);
   					writer.WriteLine("};");
   				}
   				if (hasFragment)
   				{
   					// fout struct (frag output)
   					writer.WriteIndent(3);
   					writer.WriteLine($"struct {USILConstants.FRAG_OUTPUT_STRUCT_NAME}");
   					writer.WriteIndent(3);
   					writer.WriteLine("{");

   					DirectXCompiledShader? dxShader = fragmentConverter!.DxShader;
   					Debug.Assert(dxShader != null);
   					foreach (OSGN.Output output in dxShader.Osgn.outputs)
   					{
   						string format = DXShaderNamingUtils.GetOSGNFormatName(output);
   						string type = output.name + output.index;
   						string name = DXShaderNamingUtils.GetOSGNOutputName(output);

   						writer.WriteIndent(4);
   						writer.WriteLine($"{format} {name} : {type};");
   					}

   					writer.WriteIndent(3);
   					writer.WriteLine("};");
   				}

   				HashSet<string?> declaredBufs = new();

   				if (hasVertex)
   				{
   					writer.WriteIndent(3);
   					writer.WriteLine("// $Globals ConstantBuffers for Vertex Shader");

   					ExportPassConstantBufferDefinitions(vertexSubProgram!, writer, declaredBufs, "$Globals", 3);
   				}

   				if (hasFragment)
   				{
   					writer.WriteIndent(3);
   					writer.WriteLine("// $Globals ConstantBuffers for Fragment Shader");

   					ExportPassConstantBufferDefinitions(fragmentSubProgram!, writer, declaredBufs, "$Globals", 3);
   				}

   				if (hasVertex)
   				{
   					writer.WriteIndent(3);
   					writer.WriteLine("// Custom ConstantBuffers for Vertex Shader");

   					foreach (ConstantBuffer cbuffer in vertexSubProgram!.ConstantBuffers)
   					{
   						if (UnityShaderConstants.BUILTIN_CBUFFER_NAMES.Contains(cbuffer.Name))
   						{
   							continue;
   						}

   						ExportPassConstantBufferDefinitions(vertexSubProgram, writer, declaredBufs, cbuffer, 3);
   					}
   				}

   				if (hasFragment)
   				{
   					writer.WriteIndent(3);
   					writer.WriteLine("// Custom ConstantBuffers for Fragment Shader");

   					foreach (ConstantBuffer cbuffer in fragmentSubProgram!.ConstantBuffers)
   					{
   						if (UnityShaderConstants.BUILTIN_CBUFFER_NAMES.Contains(cbuffer.Name))
   						{
   							continue;
   						}

   						ExportPassConstantBufferDefinitions(fragmentSubProgram, writer, declaredBufs, cbuffer, 3);
   					}
   				}

   				if (hasVertex)
   				{
   					writer.WriteIndent(3);
   					writer.WriteLine("// Texture params for Vertex Shader");

   					ExportPassTextureParamDefinitions(vertexSubProgram!, writer, declaredBufs, 3);
   				}

   				if (hasFragment)
   				{
   					writer.WriteIndent(3);
   					writer.WriteLine("// Texture params for Fragment Shader");

   					ExportPassTextureParamDefinitions(fragmentSubProgram!, writer, declaredBufs, 3);
   				}

   				writer.WriteIndent(3);
   				writer.WriteLine("");

   				if (hasVertex)
   				{
   					string keywordsList = string.Join(' ', vertexSubProgram!.LocalKeywords.Concat(vertexSubProgram.GlobalKeywords));

   					writer.WriteIndent(3);
   					writer.WriteLine($"// Keywords: {keywordsList}");

   					writer.WriteIndent(3);
   					writer.WriteLine($"{USILConstants.VERT_TO_FRAG_STRUCT_NAME} vert(appdata_full {USILConstants.VERT_INPUT_NAME})");
   					writer.WriteIndent(3);
   					writer.WriteLine("{");

+ 						CommonParameterConverted vertbinds = CreateBindings(_this, _this.ProgVertex.CommonParameters);```


   					vertexConverter!.ConvertShaderToUShaderProgram();
+						vertexConverter.ApplyMetadataToProgram(vertexSubProgram, vertbinds, writer.Version);
   					string progamText = vertexConverter.CovnertUShaderProgramToHLSL(4);
   					writer.Write(progamText);

   					writer.WriteIndent(3);
   					writer.WriteLine("}");
   				}

   				if (hasFragment)
   				{
   					string keywordsList = string.Join(' ', fragmentSubProgram!.LocalKeywords.Concat(fragmentSubProgram.GlobalKeywords));

   					writer.WriteIndent(3);
   					writer.WriteLine($"// Keywords: {keywordsList}");

   					// needs to move somewhere else...
   					DirectXCompiledShader? dxShader = fragmentConverter!.DxShader;
   					Debug.Assert(dxShader != null);
   					bool hasFrontFace = dxShader.Isgn.inputs.Any(i => i.name == "SV_IsFrontFace");

   					writer.WriteIndent(3);

   					string args = $"{USILConstants.VERT_TO_FRAG_STRUCT_NAME} {USILConstants.FRAG_INPUT_NAME}";
   					if (hasFrontFace)
   					{
   						// not part of v2f
   						args += $", float facing: VFACE";
   					}
   					writer.WriteLine($"{USILConstants.FRAG_OUTPUT_STRUCT_NAME} frag({args})");
   					writer.WriteIndent(3);
   					writer.WriteLine("{");

+						CommonParameterConverted fragbinds = CreateBindings(_this, _this.ProgFragment.CommonParameters);

   					fragmentConverter.ConvertShaderToUShaderProgram();
+						fragmentConverter.ApplyMetadataToProgram(fragmentSubProgram, fragbinds, writer.Version);

   					string progamText = fragmentConverter.CovnertUShaderProgramToHLSL(4);
   					writer.Write(progamText);

   					writer.WriteIndent(3);
   					writer.WriteLine("}");
   				}

   				writer.WriteIndent(3);
   				writer.WriteLine("ENDCG");
   			}
   			else
   			{
   				throw new NotSupportedException($"Unsupported pass type {_this.Type}");
   			}

   			writer.WriteIndent(2);
   			writer.Write("}\n");
   		}
   	}

Here is the function used above...

File Name: USILCBufferMetadder.cs

		public static CommonParameterConverted CreateBindings(ISerializedPass _shaderPass, SerializedProgramParameters CommonParameters)
		{
			CommonParameterConverted binding = new CommonParameterConverted(CommonParameters.ConstantBufferBindings.Count, CommonParameters.ConstantBuffers.Count);

			int indexer = 0;
			foreach (SourceGenerated.Subclasses.BufferBinding.BufferBinding_2020_1_0_a17 paraBinding in CommonParameters.ConstantBufferBindings)
			{
				string buffname = (string)_shaderPass.NameIndices.First(x => x.Value == paraBinding.NameIndex).Key;
				//_shaderPass.
				binding.bufferBindings[indexer] = new BufferBinding(buffname, paraBinding.Index);
				binding.bufferBindings[indexer].NameIndex = paraBinding.NameIndex;
				binding.bufferBindings[indexer].ArraySize = paraBinding.ArraySize;
				SourceGenerated.Subclasses.ConstantBuffer.ConstantBuffer_2020_3_2 buff = CommonParameters.ConstantBuffers.First(b => b.NameIndex == binding.bufferBindings[indexer].NameIndex);
				StructParameter[] structParams = ConvertVectorParams(buff.StructParams, _shaderPass);
				MatrixParameter[] mparray = ConvertMatrixParams(buff.MatrixParams, _shaderPass);
				VectorParameter[] vectorParams = ConvertVectorParams(buff.VectorParams, _shaderPass);
				binding.constantBuffers[indexer] = new ConstantBuffer(buffname, mparray, vectorParams, structParams, buff.Size);
				binding.constantBuffers[indexer].IsPartialCB = buff.IsPartialCB;
				indexer++;
			}
			return binding;
		}

Then passed the data to function below

		private static void UseMetadata(USILOperand operand, ShaderSubProgram shaderData, CommonParameterConverted commonParameterConverted)
		{
			if (operand.operandType == USILOperandType.ConstantBuffer)
			{
				int cbRegIdx = operand.registerIndex;
				int cbArrIdx = operand.arrayIndex;

				List<int> operandMaskAddresses = new();
				foreach (int operandMask in operand.mask)
				{
					operandMaskAddresses.Add(cbArrIdx * 16 + operandMask * 4);
				}

				HashSet<NumericShaderParameter> cbParams = new HashSet<NumericShaderParameter>();
				List<int> cbMasks = new List<int>();

				BufferBinding binding;
				ConstantBuffer constantBuffer;

				if (shaderData.ConstantBufferBindings.Length < 1)
				{
					binding = commonParameterConverted.bufferBindings.First(b => b.Index == cbRegIdx);
					constantBuffer = commonParameterConverted.constantBuffers.First(b => b.Name == binding.Name);
				}
				else
				{
					binding = shaderData.ConstantBufferBindings.First(b => b.Index == cbRegIdx);
					constantBuffer = shaderData.ConstantBuffers.First(b => b.Name == binding.Name);
				}

				// Search children fields
				foreach (NumericShaderParameter param in constantBuffer.AllNumericParams)
				{
					int paramCbStart = param.Index;
					int paramCbSize = param.RowCount * param.ColumnCount * 4;
					int paramCbEnd = paramCbStart + paramCbSize;

					foreach (int operandMaskAddress in operandMaskAddresses)
					{
						if (operandMaskAddress >= paramCbStart && operandMaskAddress < paramCbEnd)
						{
							cbParams.Add(param);

							int maskIndex = (operandMaskAddress - paramCbStart) / 4;
							if (param.IsMatrix)
							{
								maskIndex %= 4;
							}
							cbMasks.Add(maskIndex);
						}
					}
				}

				// Search children structs and its fields
				foreach (StructParameter stParam in constantBuffer.StructParams)
				{
					foreach (NumericShaderParameter cbParam in stParam.AllNumericMembers)
					{
						int paramCbStart = cbParam.Index;
						int paramCbSize = cbParam.RowCount * cbParam.ColumnCount * 4;
						int paramCbEnd = paramCbStart + paramCbSize;

						foreach (int operandMaskAddress in operandMaskAddresses)
						{
							if (operandMaskAddress >= paramCbStart && operandMaskAddress < paramCbEnd)
							{
								cbParams.Add(cbParam);

								int maskIndex = (operandMaskAddress - paramCbStart) / 4;
								if (cbParam.IsMatrix)
								{
									maskIndex %= 4;
								}
								cbMasks.Add(maskIndex);
							}
						}
					}
				}

				// Multiple params got opto'd into one operation
				if (cbParams.Count > 1)
				{
					operand.operandType = USILOperandType.Multiple;
					operand.children = new USILOperand[cbParams.Count];

					int i = 0;
					List<string> paramStrs = new List<string>();
					foreach (NumericShaderParameter param in cbParams)
					{
						USILOperand childOperand = new USILOperand();
						childOperand.operandType = USILOperandType.ConstantBuffer;

						childOperand.mask = MatchMaskToConstantBuffer(operand.mask, param.Index, param.RowCount);
						childOperand.metadataName = param.Name;
						childOperand.metadataNameAssigned = true;
						childOperand.arrayRelative = operand.arrayRelative;
						childOperand.arrayIndex -= param.Index / 16;
						childOperand.metadataNameWithArray = operand.arrayRelative != null && !param.IsMatrix;

						operand.children[i++] = childOperand;
					}
				}
				else if (cbParams.Count == 1)
				{
					NumericShaderParameter param = cbParams.First();

					// Matrix
					if (param.IsMatrix)
					{
						//int matrixIdx = cbArrIdx - param.Index / 16;

						operand.operandType = USILOperandType.Matrix;
						//operand.arrayIndex = matrixIdx;
						operand.transposeMatrix = true;
					}
					//else
					//{
					operand.arrayIndex -= param.Index / 16;
					//}

					operand.mask = cbMasks.ToArray();
					operand.metadataName = param.Name;
					operand.metadataNameAssigned = true;
					operand.metadataNameWithArray = operand.arrayRelative != null && !param.IsMatrix;

					if (cbMasks.Count == param.RowCount && !param.IsMatrix)
					{
						operand.displayMask = false;
					}
				}
			}
		}

@RealCA
Copy link

RealCA commented Aug 28, 2023

Also note that above resource files are from a different game but the error I faced is same.
Also shader dosent have any issues its the shader decompiler thats lacking but for now its so far so good on simple decompilations. Devs did a pretty good job in keeping code readable and traceable so most issues can be fixed if u take some time for yourself than asking around...

@RealCA
Copy link

RealCA commented Aug 28, 2023

0a8376b

Here you can follow the changes to code.
But there some other files edited not related to shader so be aware.
Also you can download and compile it perfectly so i dont think those unnecessary changes will cause any harm

Forgot to mention it's reading only buffers from common property.
I'll add support for texture params and extra dictionary tomorrow

@MadMincraftr
Copy link
Author

@RealCA I don't feel like editing stuff rn, I can wait for sometime lol.

@RealCA
Copy link

RealCA commented Aug 29, 2023

I will be upload a release. If u like u could test

@RealCA
Copy link

RealCA commented Sep 3, 2023

@RealCA
Copy link

RealCA commented Sep 3, 2023

U will need to install net 7 😜
https://dotnet.microsoft.com/en-us/download/dotnet/7.0

@archanox
Copy link

archanox commented Nov 2, 2023

Can this be made into a PR, reviewed, tested and merged into master?

@ds5678
Copy link
Collaborator

ds5678 commented Nov 2, 2023

If someone makes a PR, I'll review it (and possibly merge it).

@ds5678
Copy link
Collaborator

ds5678 commented Nov 2, 2023

Note: If anyone sets out to do this, you will need to coauthor any commit that contains code from @RealCA, which requires their noreply anonymous email address from GitHub.

0a8376b
https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors
https://stackoverflow.com/questions/7442112/how-to-attribute-a-single-commit-to-multiple-developers

@Futuremappermydud
Copy link

Futuremappermydud commented Apr 4, 2024

@RealCA

Will you open a pr for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working shaders
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants