mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-08 13:14:56 +00:00
Remove utility to create shader modules from GLSL
And rename CreateShaderModuleFromWGSL to CreateShaderModule. Bug: dawn:572 Change-Id: I80dab401078b2001d738b87d6e24437f93b690d1 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/45764 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Austin Eng <enga@chromium.org> Auto-Submit: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
1452cf60e5
commit
7aec4ae7c5
@@ -55,8 +55,7 @@ void init() {
|
||||
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::RenderAttachment,
|
||||
640, 480);
|
||||
|
||||
wgpu::ShaderModule vsModule =
|
||||
utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Constants {
|
||||
scale : f32;
|
||||
time : f32;
|
||||
@@ -108,7 +107,7 @@ void init() {
|
||||
Position = vec4<f32>(xpos, ypos, 0.0, 1.0);
|
||||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[location(0)]] var<out> FragColor : vec4<f32>;
|
||||
[[location(0)]] var<in> v_color : vec4<f32>;
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ void init() {
|
||||
" Position = vec4<f32>(pos[VertexIndex], 0.0, 1.0);\n"
|
||||
" return;\n"
|
||||
"}\n";
|
||||
WGPUShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, vs).Release();
|
||||
WGPUShaderModule vsModule = utils::CreateShaderModule(device, vs).Release();
|
||||
|
||||
const char* fs =
|
||||
"[[location(0)]] var<out> fragColor : vec4<f32>;\n"
|
||||
@@ -56,7 +56,7 @@ void init() {
|
||||
" fragColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);\n"
|
||||
" return;\n"
|
||||
"}\n";
|
||||
WGPUShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, fs).Release();
|
||||
WGPUShaderModule fsModule = utils::CreateShaderModule(device, fs).Release();
|
||||
|
||||
{
|
||||
WGPURenderPipelineDescriptor2 descriptor = {};
|
||||
|
||||
@@ -95,7 +95,7 @@ void initBuffers() {
|
||||
}
|
||||
|
||||
void initRender() {
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||
[[location(0)]] var<in> a_particlePos : vec2<f32>;
|
||||
[[location(1)]] var<in> a_particleVel : vec2<f32>;
|
||||
[[location(2)]] var<in> a_pos : vec2<f32>;
|
||||
@@ -112,7 +112,7 @@ void initRender() {
|
||||
}
|
||||
)");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[location(0)]] var<out> FragColor : vec4<f32>;
|
||||
[[stage(fragment)]]
|
||||
fn main() -> void {
|
||||
@@ -149,7 +149,7 @@ void initRender() {
|
||||
}
|
||||
|
||||
void initSim() {
|
||||
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
|
||||
struct Particle {
|
||||
pos : vec2<f32>;
|
||||
vel : vec2<f32>;
|
||||
|
||||
@@ -95,7 +95,7 @@ void init() {
|
||||
initBuffers();
|
||||
initTextures();
|
||||
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
[[location(0)]] var<in> pos : vec4<f32>;
|
||||
[[stage(vertex)]] fn main() -> void {
|
||||
@@ -103,7 +103,7 @@ void init() {
|
||||
return;
|
||||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
|
||||
[[group(0), binding(0)]] var mySampler: sampler;
|
||||
[[group(0), binding(1)]] var myTexture : texture_2d<f32>;
|
||||
|
||||
@@ -101,7 +101,7 @@ void init() {
|
||||
|
||||
initBuffers();
|
||||
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||
[[block]] struct Camera {
|
||||
view : mat4x4<f32>;
|
||||
proj : mat4x4<f32>;
|
||||
@@ -125,7 +125,7 @@ void init() {
|
||||
return;
|
||||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
[[location(0)]] var<out> FragColor : vec4<f32>;
|
||||
[[location(2)]] var<in> f_col : vec3<f32>;
|
||||
|
||||
@@ -134,7 +134,7 @@ void init() {
|
||||
return;
|
||||
})");
|
||||
|
||||
wgpu::ShaderModule fsReflectionModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
wgpu::ShaderModule fsReflectionModule = utils::CreateShaderModule(device, R"(
|
||||
[[location(0)]] var<out> FragColor : vec4<f32>;
|
||||
[[location(2)]] var<in> f_col : vec3<f32>;
|
||||
|
||||
|
||||
@@ -312,7 +312,7 @@ int main(int argc, const char* argv[]) {
|
||||
|
||||
// The hacky pipeline to render a triangle.
|
||||
utils::ComboRenderPipelineDescriptor2 pipelineDesc;
|
||||
pipelineDesc.vertex.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"(
|
||||
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
||||
@@ -324,7 +324,7 @@ int main(int argc, const char* argv[]) {
|
||||
Position = vec4<f32>(pos[VertexIndex], 0.0, 1.0);
|
||||
return;
|
||||
})");
|
||||
pipelineDesc.cFragment.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
pipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"(
|
||||
[[location(0)]] var<out> fragColor : vec4<f32>;
|
||||
[[stage(fragment)]] fn main() -> void {
|
||||
fragColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||
|
||||
Reference in New Issue
Block a user