프로젝트
GitHub에서 보기
CodyJasonBennett/vite-slang
CodyJasonBennett/vite-slang has 35 GitHub stars and 3 forks. GitHot measured 0 stars in 24 hours, 0 in 7 days, and 0 in 15 days. Last checked 2026-11-21 19:22 UTC. Last push 2026-11-04.
측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
소개
Vite plugin to use Slang shaders on the web.
창작 및 미디어README.md
Originalvite-slang
Vite plugin for importing and compiling Slang shaders to run on the web (WebGL/WebGPU).
// vite.config.js
import { defineConfig } from 'vite'
import slang from 'vite-slang'
export default defineConfig({
plugins: [slang()],
})
Usage
// shader.slang
struct VertexStageInput
{
float4 position : POSITION0;
};
struct VertexStageOutput
{
float4 positionClipSpace : SV_POSITION;
};
struct FragmentStageOutput
{
float4 color : SV_TARGET;
};
[shader("vertex")]
VertexStageOutput vertexMain(VertexStageInput input) : SV_Position
{
VertexStageOutput output;
output.positionClipSpace = float4(input.position.xy, 1);
return output;
}
[shader("fragment")]
FragmentStageOutput fragmentMain() : SV_Target
{
FragmentStageOutput output;
output.color = float4(0, 1, 0, 1);
return output;
}
// app.js
import code from './shader.slang'
import { code, reflection } from './shader.slang'
const shader = device.createShaderModule({ code })
const pipeline = device.createRenderPipeline({
vertex: {
module: shader,
entryPoint: 'vertexMain',
},
fragment: {
module: shader,
entryPoint: 'fragmentMain',
targets: [{ format: 'bgra8unorm' }],
},
layout: 'auto',
})
console.log(reflection) // metadata about entry points, bindings, etc.
관련 프로젝트 살펴보기
불러오는 중…