Jump to content
  • Advertisement
Sign in to follow this  
MysteryX

Configure Pixel Shader Without Device

This topic is 1064 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have code that runs series of HLSL pixel shader commands on video frame data. In order to avoid having to create a device for every command, I'm now first configuring all the pixel shaders and their parameters, then at the end I'm creating the device and running all the pixel shaders as a chain of commands.

 

It's working fine if I don't have to configure pixel shader parameters, and I'm encountering an issue.

 

Creating the Pixel Shader and getting the Constant Table works fine.

HRESULT D3D9RenderImpl::InitPixelShader(CommandStruct* cmd, DWORD* buffer) {
	cmd->ShaderBuffer = buffer;
	return (D3DXGetShaderConstantTable(buffer, &cmd->ConstantTable));
}

However, setting parameters on a ConstantTable requires a device, which I don't have at this point.

HRESULT D3D9RenderImpl::SetPixelShaderIntConstant(LPD3DXCONSTANTTABLE table, LPCSTR name, int value)
{
	return table->SetInt(m_pDevice, name, value);
}

I tried creating a dummy device to allow configuring the pixel shaders, but then CreatePixelShader fails when running it on the real device. Probably because the Constant Table was configured with a different device.

m_pDevice->CreatePixelShader(cmd->ShaderBuffer, &pShader)

So my question is this. Can I configure the Pixel Shader without the device?

 

 

EDIT: I ended up solving my problem by passing the configuration parameters to the last class who is creating the device, and only then I'm creating the shaders and configuring them. That way it works.

Edited by MysteryX

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!