private void Update(EvaluationContext context) { var resourceManager = ResourceManager.Instance(); if (Source.DirtyFlag.IsDirty || EntryPoint.DirtyFlag.IsDirty || DebugName.DirtyFlag.IsDirty) { string sourcePath = Source.GetValue(context); string entryPoint = EntryPoint.GetValue(context); string debugName = DebugName.GetValue(context); if (string.IsNullOrEmpty(debugName)) { debugName = new FileInfo(sourcePath).Name; } _vertexShaderResId = resourceManager.CreateVertexShaderFromFile(sourcePath, entryPoint, debugName, () => Shader.DirtyFlag.Invalidate()); } else { resourceManager.UpdateVertexShaderFromFile(Source.Value, _vertexShaderResId, ref Shader.Value); } if (_vertexShaderResId != ResourceManager.NullResource) { Shader.Value = resourceManager.GetVertexShader(_vertexShaderResId); } }
private void Update(EvaluationContext context) { var resourceManager = ResourceManager.Instance(); if (Source.DirtyFlag.IsDirty || EntryPoint.DirtyFlag.IsDirty || DebugName.DirtyFlag.IsDirty) { string sourcePath = Source.GetValue(context); string entryPoint = EntryPoint.GetValue(context); string debugName = DebugName.GetValue(context); if (string.IsNullOrEmpty(debugName) && !string.IsNullOrEmpty(sourcePath)) { try { debugName = new FileInfo(sourcePath).Name; } catch (Exception e) { Log.Error($"Invalid sourcePath for shader: {sourcePath}: " + e.Message); return; } } _pixelShaderResId = resourceManager.CreatePixelShaderFromFile(sourcePath, entryPoint, debugName, () => Shader.DirtyFlag.Invalidate()); } else { resourceManager.UpdatePixelShaderFromFile(Source.Value, _pixelShaderResId, ref Shader.Value); } if (_pixelShaderResId != ResourceManager.NullResource) { Shader.Value = resourceManager.GetPixelShader(_pixelShaderResId); } }
private void Update(EvaluationContext context) { var resourceManager = ResourceManager.Instance(); if (Source.DirtyFlag.IsDirty || EntryPoint.DirtyFlag.IsDirty || DebugName.DirtyFlag.IsDirty) { string sourcePath = Source.GetValue(context); string entryPoint = EntryPoint.GetValue(context); string debugName = DebugName.GetValue(context); if (string.IsNullOrEmpty(debugName) && !string.IsNullOrEmpty(sourcePath)) { debugName = new FileInfo(sourcePath).Name; } _computeShaderResId = resourceManager.CreateComputeShaderFromFile(sourcePath, entryPoint, debugName, () => ComputerShader.DirtyFlag.Invalidate()); Log.Debug($"compute shader {sourcePath}:{entryPoint}", SymbolChildId); } else { resourceManager.UpdateComputeShaderFromFile(Source.Value, _computeShaderResId, ref ComputerShader.Value); } if (_computeShaderResId != ResourceManager.NullResource) { ComputerShader.Value = resourceManager.GetComputeShader(_computeShaderResId); var shaderReflection = new ShaderReflection(resourceManager.GetComputeShaderBytecode(_computeShaderResId)); shaderReflection.GetThreadGroupSize(out int x, out int y, out int z); ThreadCount.Value = new Int3(x, y, z); } }
private void Update(EvaluationContext context) { var resourceManager = ResourceManager.Instance(); if (Source.DirtyFlag.IsDirty || EntryPoint.DirtyFlag.IsDirty || DebugName.DirtyFlag.IsDirty) { string sourcePath = Source.GetValue(context); string entryPoint = EntryPoint.GetValue(context); string debugName = DebugName.GetValue(context); if (string.IsNullOrEmpty(debugName)) { debugName = new FileInfo(sourcePath).Name; } _vertexShaderResId = resourceManager.CreateVertexShaderFromFile(sourcePath, entryPoint, debugName, () => Shader.DirtyFlag.Invalidate()); try { _description = "VertexShader\n" + Path.GetFileName(sourcePath); } catch { Log.Warning($"Unable to get filename from {sourcePath}", SymbolChildId); } } else { resourceManager.UpdateVertexShaderFromFile(Source.Value, _vertexShaderResId, ref Shader.Value); } if (_vertexShaderResId != ResourceManager.NullResource) { Shader.Value = resourceManager.GetVertexShader(_vertexShaderResId); } }
private void Update(EvaluationContext context) { var resourceManager = ResourceManager.Instance(); if (Source.DirtyFlag.IsDirty || EntryPoint.DirtyFlag.IsDirty || DebugName.DirtyFlag.IsDirty) { string sourcePath = Source.GetValue(context); if (!File.Exists(sourcePath)) { Log.Warning($"GeometryShader has incorrect or missing path {sourcePath}", SymbolChildId); return; } string entryPoint = EntryPoint.GetValue(context); string debugName = DebugName.GetValue(context); if (string.IsNullOrEmpty(debugName)) { try { debugName = new FileInfo(sourcePath).Name; } catch { debugName = "unknownPath"; } } _geometryShaderResId = resourceManager.CreateGeometryShaderFromFile(sourcePath, entryPoint, debugName, () => Shader.DirtyFlag.Invalidate()); } else { resourceManager.UpdateGeometryShaderFromFile(Source.Value, _geometryShaderResId, ref Shader.Value); } if (_geometryShaderResId != ResourceManager.NullResource) { Shader.Value = resourceManager.GetGeometryShader(_geometryShaderResId); } }