DirectX11 - Geometry Shader Stream Output Stream Undefined
I'm trying to create a geometry shader which uses the stream output stage following the outline provided on MSDN: Link
However when trying to do this I get the following error:
ID3D11Device::CreateGeometryShaderWithStreamOutput: Stream (=3435973836) must be less than or equal to 3.
As far as I'm aware, the only point at which I can define the stream is in the stream output declaration entry, but I've already done this (code below).
// Reads compiled shader into a buffer
HRESULT result = D3DReadFileToBlob(filename, &geometryShaderBuffer);
D3D11_SO_DECLARATION_ENTRY SODeclarationEntry[3] =
{
{ 0, "POSITION", 0, 0, 3, 0 },
{ 0, "NORMAL", 0, 0, 3, 0 },
{ 0, "TEXCOORD", 0, 0, 3, 0 }
};
// Create the geometry shader from the buffer & SO declaration
result = renderer->CreateGeometryShaderWithStreamOutput(geometryShaderBuffer->GetBufferPointer(), geometryShaderBuffer->GetBufferSize(), SODeclarationEntry, sizeof(SODeclarationEntry),
NULL, 0, 0, NULL, &streamOutputGeometryShader);
Is there somewhere else where I'm supposed to be defining an output stream?
c++ directx hlsl
add a comment |
I'm trying to create a geometry shader which uses the stream output stage following the outline provided on MSDN: Link
However when trying to do this I get the following error:
ID3D11Device::CreateGeometryShaderWithStreamOutput: Stream (=3435973836) must be less than or equal to 3.
As far as I'm aware, the only point at which I can define the stream is in the stream output declaration entry, but I've already done this (code below).
// Reads compiled shader into a buffer
HRESULT result = D3DReadFileToBlob(filename, &geometryShaderBuffer);
D3D11_SO_DECLARATION_ENTRY SODeclarationEntry[3] =
{
{ 0, "POSITION", 0, 0, 3, 0 },
{ 0, "NORMAL", 0, 0, 3, 0 },
{ 0, "TEXCOORD", 0, 0, 3, 0 }
};
// Create the geometry shader from the buffer & SO declaration
result = renderer->CreateGeometryShaderWithStreamOutput(geometryShaderBuffer->GetBufferPointer(), geometryShaderBuffer->GetBufferSize(), SODeclarationEntry, sizeof(SODeclarationEntry),
NULL, 0, 0, NULL, &streamOutputGeometryShader);
Is there somewhere else where I'm supposed to be defining an output stream?
c++ directx hlsl
add a comment |
I'm trying to create a geometry shader which uses the stream output stage following the outline provided on MSDN: Link
However when trying to do this I get the following error:
ID3D11Device::CreateGeometryShaderWithStreamOutput: Stream (=3435973836) must be less than or equal to 3.
As far as I'm aware, the only point at which I can define the stream is in the stream output declaration entry, but I've already done this (code below).
// Reads compiled shader into a buffer
HRESULT result = D3DReadFileToBlob(filename, &geometryShaderBuffer);
D3D11_SO_DECLARATION_ENTRY SODeclarationEntry[3] =
{
{ 0, "POSITION", 0, 0, 3, 0 },
{ 0, "NORMAL", 0, 0, 3, 0 },
{ 0, "TEXCOORD", 0, 0, 3, 0 }
};
// Create the geometry shader from the buffer & SO declaration
result = renderer->CreateGeometryShaderWithStreamOutput(geometryShaderBuffer->GetBufferPointer(), geometryShaderBuffer->GetBufferSize(), SODeclarationEntry, sizeof(SODeclarationEntry),
NULL, 0, 0, NULL, &streamOutputGeometryShader);
Is there somewhere else where I'm supposed to be defining an output stream?
c++ directx hlsl
I'm trying to create a geometry shader which uses the stream output stage following the outline provided on MSDN: Link
However when trying to do this I get the following error:
ID3D11Device::CreateGeometryShaderWithStreamOutput: Stream (=3435973836) must be less than or equal to 3.
As far as I'm aware, the only point at which I can define the stream is in the stream output declaration entry, but I've already done this (code below).
// Reads compiled shader into a buffer
HRESULT result = D3DReadFileToBlob(filename, &geometryShaderBuffer);
D3D11_SO_DECLARATION_ENTRY SODeclarationEntry[3] =
{
{ 0, "POSITION", 0, 0, 3, 0 },
{ 0, "NORMAL", 0, 0, 3, 0 },
{ 0, "TEXCOORD", 0, 0, 3, 0 }
};
// Create the geometry shader from the buffer & SO declaration
result = renderer->CreateGeometryShaderWithStreamOutput(geometryShaderBuffer->GetBufferPointer(), geometryShaderBuffer->GetBufferSize(), SODeclarationEntry, sizeof(SODeclarationEntry),
NULL, 0, 0, NULL, &streamOutputGeometryShader);
Is there somewhere else where I'm supposed to be defining an output stream?
c++ directx hlsl
c++ directx hlsl
asked Nov 16 '18 at 16:19
MattBT12MattBT12
314
314
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The problem here is that you have provided far too large a number for NumEntries
so it's reading a bunch of junk entries after the 3 you have defined for pSODeclaration
. That's why the validation error debug output is reporting nonsense values like "Stream (=3435973836)".
result = renderer->CreateGeometryShaderWithStreamOutput(
geometryShaderBuffer->GetBufferPointer(), geometryShaderBuffer->GetBufferSize(),
SODeclarationEntry, sizeof(SODeclarationEntry),
nullptr, 0, 0, nullptr, &streamOutputGeometryShader);
should be:
result = renderer->CreateGeometryShaderWithStreamOutput(
geometryShaderBuffer->GetBufferPointer(), geometryShaderBuffer->GetBufferSize(),
SODeclarationEntry, _countof(SODeclarationEntry),
nullptr, 0, 0, nullptr, &streamOutputGeometryShader);
Note that if you are working with a different compiler than Microsoft Visual C++, _countof
is:
#define _countof(array) (sizeof(array) / sizeof(array[0]))
BTW, this is the kind of bug that static code analysis (/analyze
) and the SAL annotations that are used for the Windows system headers can find for you:
warning C6385: Reading invalid data from 'SODeclarationEntry': the readable
size is '48' bytes, but '768' bytes may be read.
See Microsoft Docs for more information.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53341742%2fdirectx11-geometry-shader-stream-output-stream-undefined%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The problem here is that you have provided far too large a number for NumEntries
so it's reading a bunch of junk entries after the 3 you have defined for pSODeclaration
. That's why the validation error debug output is reporting nonsense values like "Stream (=3435973836)".
result = renderer->CreateGeometryShaderWithStreamOutput(
geometryShaderBuffer->GetBufferPointer(), geometryShaderBuffer->GetBufferSize(),
SODeclarationEntry, sizeof(SODeclarationEntry),
nullptr, 0, 0, nullptr, &streamOutputGeometryShader);
should be:
result = renderer->CreateGeometryShaderWithStreamOutput(
geometryShaderBuffer->GetBufferPointer(), geometryShaderBuffer->GetBufferSize(),
SODeclarationEntry, _countof(SODeclarationEntry),
nullptr, 0, 0, nullptr, &streamOutputGeometryShader);
Note that if you are working with a different compiler than Microsoft Visual C++, _countof
is:
#define _countof(array) (sizeof(array) / sizeof(array[0]))
BTW, this is the kind of bug that static code analysis (/analyze
) and the SAL annotations that are used for the Windows system headers can find for you:
warning C6385: Reading invalid data from 'SODeclarationEntry': the readable
size is '48' bytes, but '768' bytes may be read.
See Microsoft Docs for more information.
add a comment |
The problem here is that you have provided far too large a number for NumEntries
so it's reading a bunch of junk entries after the 3 you have defined for pSODeclaration
. That's why the validation error debug output is reporting nonsense values like "Stream (=3435973836)".
result = renderer->CreateGeometryShaderWithStreamOutput(
geometryShaderBuffer->GetBufferPointer(), geometryShaderBuffer->GetBufferSize(),
SODeclarationEntry, sizeof(SODeclarationEntry),
nullptr, 0, 0, nullptr, &streamOutputGeometryShader);
should be:
result = renderer->CreateGeometryShaderWithStreamOutput(
geometryShaderBuffer->GetBufferPointer(), geometryShaderBuffer->GetBufferSize(),
SODeclarationEntry, _countof(SODeclarationEntry),
nullptr, 0, 0, nullptr, &streamOutputGeometryShader);
Note that if you are working with a different compiler than Microsoft Visual C++, _countof
is:
#define _countof(array) (sizeof(array) / sizeof(array[0]))
BTW, this is the kind of bug that static code analysis (/analyze
) and the SAL annotations that are used for the Windows system headers can find for you:
warning C6385: Reading invalid data from 'SODeclarationEntry': the readable
size is '48' bytes, but '768' bytes may be read.
See Microsoft Docs for more information.
add a comment |
The problem here is that you have provided far too large a number for NumEntries
so it's reading a bunch of junk entries after the 3 you have defined for pSODeclaration
. That's why the validation error debug output is reporting nonsense values like "Stream (=3435973836)".
result = renderer->CreateGeometryShaderWithStreamOutput(
geometryShaderBuffer->GetBufferPointer(), geometryShaderBuffer->GetBufferSize(),
SODeclarationEntry, sizeof(SODeclarationEntry),
nullptr, 0, 0, nullptr, &streamOutputGeometryShader);
should be:
result = renderer->CreateGeometryShaderWithStreamOutput(
geometryShaderBuffer->GetBufferPointer(), geometryShaderBuffer->GetBufferSize(),
SODeclarationEntry, _countof(SODeclarationEntry),
nullptr, 0, 0, nullptr, &streamOutputGeometryShader);
Note that if you are working with a different compiler than Microsoft Visual C++, _countof
is:
#define _countof(array) (sizeof(array) / sizeof(array[0]))
BTW, this is the kind of bug that static code analysis (/analyze
) and the SAL annotations that are used for the Windows system headers can find for you:
warning C6385: Reading invalid data from 'SODeclarationEntry': the readable
size is '48' bytes, but '768' bytes may be read.
See Microsoft Docs for more information.
The problem here is that you have provided far too large a number for NumEntries
so it's reading a bunch of junk entries after the 3 you have defined for pSODeclaration
. That's why the validation error debug output is reporting nonsense values like "Stream (=3435973836)".
result = renderer->CreateGeometryShaderWithStreamOutput(
geometryShaderBuffer->GetBufferPointer(), geometryShaderBuffer->GetBufferSize(),
SODeclarationEntry, sizeof(SODeclarationEntry),
nullptr, 0, 0, nullptr, &streamOutputGeometryShader);
should be:
result = renderer->CreateGeometryShaderWithStreamOutput(
geometryShaderBuffer->GetBufferPointer(), geometryShaderBuffer->GetBufferSize(),
SODeclarationEntry, _countof(SODeclarationEntry),
nullptr, 0, 0, nullptr, &streamOutputGeometryShader);
Note that if you are working with a different compiler than Microsoft Visual C++, _countof
is:
#define _countof(array) (sizeof(array) / sizeof(array[0]))
BTW, this is the kind of bug that static code analysis (/analyze
) and the SAL annotations that are used for the Windows system headers can find for you:
warning C6385: Reading invalid data from 'SODeclarationEntry': the readable
size is '48' bytes, but '768' bytes may be read.
See Microsoft Docs for more information.
edited Nov 16 '18 at 19:01
answered Nov 16 '18 at 18:03
Chuck WalbournChuck Walbourn
20k12549
20k12549
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53341742%2fdirectx11-geometry-shader-stream-output-stream-undefined%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown