internal static MyShaderPass GetOrCreate(string tag) { MyShaderPass cached; bool rebuild = false; if (!m_cached.TryGetValue(tag, out cached)) { cached = new MyShaderPass(); rebuild = true; m_cached[tag] = cached; } if (rebuild) { using (var stream = MyFileSystem.OpenRead(Path.Combine(MyFileSystem.ContentPath, "Shaders/passes", tag), "vertex_stage.hlsl")) { cached.m_vertexStageSrc = new StreamReader(stream).ReadToEnd(); } using (var stream = MyFileSystem.OpenRead(Path.Combine(MyFileSystem.ContentPath, "Shaders/passes", tag), "pixel_stage.hlsl")) { cached.m_pixelStageSrc = new StreamReader(stream).ReadToEnd(); } } return(cached); }
internal static MyShaderPass GetOrCreate(string tag) { MyShaderPass cached; bool rebuild = false; if (!m_cached.TryGetValue(tag, out cached)) { cached = new MyShaderPass(); rebuild = true; m_cached[tag] = cached; } if(rebuild) { using (var stream = MyFileSystem.OpenRead(Path.Combine(MyFileSystem.ContentPath, "Shaders/passes", tag), "vertex_stage.hlsl")) { cached.m_vertexStageSrc = new StreamReader(stream).ReadToEnd(); } using (var stream = MyFileSystem.OpenRead(Path.Combine(MyFileSystem.ContentPath, "Shaders/passes", tag), "pixel_stage.hlsl")) { cached.m_pixelStageSrc = new StreamReader(stream).ReadToEnd(); } } return cached; }