summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/model-viewer/main.cpp3
-rw-r--r--examples/ray-tracing-pipeline/main.cpp4
-rw-r--r--examples/ray-tracing/main.cpp4
-rw-r--r--examples/shader-toy/main.cpp3
-rw-r--r--examples/triangle/main.cpp3
5 files changed, 10 insertions, 7 deletions
diff --git a/examples/model-viewer/main.cpp b/examples/model-viewer/main.cpp
index bd8e2ad2f..dcc1a975f 100644
--- a/examples/model-viewer/main.cpp
+++ b/examples/model-viewer/main.cpp
@@ -748,6 +748,7 @@ Result initialize()
{"UV", 0, Format::R32G32_FLOAT, offsetof(Model::Vertex, uv) },
};
auto inputLayout = gDevice->createInputLayout(
+ sizeof(Model::Vertex),
&inputElements[0],
3);
if(!inputLayout) return SLANG_FAIL;
@@ -868,7 +869,7 @@ void renderFrame(int frameIndex) override
//
for(auto& model : gModels)
{
- drawCommandEncoder->setVertexBuffer(0, model->vertexBuffer, sizeof(Model::Vertex));
+ drawCommandEncoder->setVertexBuffer(0, model->vertexBuffer);
drawCommandEncoder->setIndexBuffer(model->indexBuffer, Format::R32_UINT);
// For each model we provide a parameter
// block that holds the per-model transformation
diff --git a/examples/ray-tracing-pipeline/main.cpp b/examples/ray-tracing-pipeline/main.cpp
index 9ae44a3fc..e927b9d10 100644
--- a/examples/ray-tracing-pipeline/main.cpp
+++ b/examples/ray-tracing-pipeline/main.cpp
@@ -504,7 +504,7 @@ Slang::Result initialize()
InputElementDesc inputElements[] = {
{"POSITION", 0, Format::R32G32_FLOAT, offsetof(FullScreenTriangle::Vertex, position)},
};
- auto inputLayout = gDevice->createInputLayout(&inputElements[0], SLANG_COUNT_OF(inputElements));
+ auto inputLayout = gDevice->createInputLayout(sizeof(FullScreenTriangle::Vertex), &inputElements[0], SLANG_COUNT_OF(inputElements));
if (!inputLayout)
return SLANG_FAIL;
@@ -643,7 +643,7 @@ virtual void renderFrame(int frameBufferIndex) override
auto cursor = ShaderCursor(rootObject->getEntryPoint(1));
cursor["t"].setResource(gResultTextureUAV);
presentEncoder->setVertexBuffer(
- 0, gFullScreenVertexBuffer, sizeof(FullScreenTriangle::Vertex));
+ 0, gFullScreenVertexBuffer);
presentEncoder->setPrimitiveTopology(PrimitiveTopology::TriangleList);
presentEncoder->draw(3);
presentEncoder->endEncoding();
diff --git a/examples/ray-tracing/main.cpp b/examples/ray-tracing/main.cpp
index 1285be866..e26393cbc 100644
--- a/examples/ray-tracing/main.cpp
+++ b/examples/ray-tracing/main.cpp
@@ -496,7 +496,7 @@ Slang::Result initialize()
InputElementDesc inputElements[] = {
{"POSITION", 0, Format::R32G32_FLOAT, offsetof(FullScreenTriangle::Vertex, position)},
};
- auto inputLayout = gDevice->createInputLayout(&inputElements[0], SLANG_COUNT_OF(inputElements));
+ auto inputLayout = gDevice->createInputLayout(sizeof(FullScreenTriangle::Vertex), &inputElements[0], SLANG_COUNT_OF(inputElements));
if (!inputLayout)
return SLANG_FAIL;
@@ -622,7 +622,7 @@ virtual void renderFrame(int frameBufferIndex) override
auto cursor = ShaderCursor(rootObject->getEntryPoint(1));
cursor["t"].setResource(gResultTextureUAV);
presentEncoder->setVertexBuffer(
- 0, gFullScreenVertexBuffer, sizeof(FullScreenTriangle::Vertex));
+ 0, gFullScreenVertexBuffer);
presentEncoder->setPrimitiveTopology(PrimitiveTopology::TriangleList);
presentEncoder->draw(3);
presentEncoder->endEncoding();
diff --git a/examples/shader-toy/main.cpp b/examples/shader-toy/main.cpp
index facaeb75f..879330aca 100644
--- a/examples/shader-toy/main.cpp
+++ b/examples/shader-toy/main.cpp
@@ -284,6 +284,7 @@ Result initialize()
{ "POSITION", 0, Format::R32G32_FLOAT, offsetof(FullScreenTriangle::Vertex, position) },
};
auto inputLayout = gDevice->createInputLayout(
+ sizeof(FullScreenTriangle::Vertex),
&inputElements[0],
SLANG_COUNT_OF(inputElements));
if(!inputLayout) return SLANG_FAIL;
@@ -367,7 +368,7 @@ virtual void renderFrame(int frameIndex) override
auto constantBuffer = rootObject->getObject(ShaderOffset());
constantBuffer->setData(ShaderOffset(), &uniforms, sizeof(uniforms));
- encoder->setVertexBuffer(0, gVertexBuffer, sizeof(FullScreenTriangle::Vertex));
+ encoder->setVertexBuffer(0, gVertexBuffer);
encoder->setPrimitiveTopology(PrimitiveTopology::TriangleList);
encoder->draw(3);
encoder->endEncoding();
diff --git a/examples/triangle/main.cpp b/examples/triangle/main.cpp
index 51d355e50..a81a105ab 100644
--- a/examples/triangle/main.cpp
+++ b/examples/triangle/main.cpp
@@ -227,6 +227,7 @@ Slang::Result initialize()
{ "COLOR", 0, Format::R32G32B32_FLOAT, offsetof(Vertex, color) },
};
auto inputLayout = gDevice->createInputLayout(
+ sizeof(Vertex),
&inputElements[0],
2);
if(!inputLayout) return SLANG_FAIL;
@@ -373,7 +374,7 @@ virtual void renderFrame(int frameBufferIndex) override
// We also need to set up a few pieces of fixed-function pipeline
// state that are not bound by the pipeline state above.
//
- renderEncoder->setVertexBuffer(0, gVertexBuffer, sizeof(Vertex));
+ renderEncoder->setVertexBuffer(0, gVertexBuffer);
renderEncoder->setPrimitiveTopology(PrimitiveTopology::TriangleList);
// Finally, we are ready to issue a draw call for a single triangle.