本文整理汇总了C++中IDirect3DDevice9::SetPixelShaderConstantF方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirect3DDevice9::SetPixelShaderConstantF方法的具体用法?C++ IDirect3DDevice9::SetPixelShaderConstantF怎么用?C++ IDirect3DDevice9::SetPixelShaderConstantF使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirect3DDevice9
的用法示例。
在下文中一共展示了IDirect3DDevice9::SetPixelShaderConstantF方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Enable
//----------------------------------------------------------------------------
void PdrPixelShader::Enable (Renderer* renderer, const PixelShader* pshader,
const ShaderParameters* parameters)
{
IDirect3DDevice9* device = renderer->mData->mDevice;
// Enable the buffer by setting the state.
HRESULT hr = device->SetPixelShader(mShader);
assertion(hr == D3D_OK, "Failed to enable pixel shader: %s\n",
DXGetErrorString(hr));
// Set the shader constants.
int profile = PixelShader::GetProfile();
const int numConstants = pshader->GetNumConstants();
int i;
for (i = 0; i < numConstants; ++i)
{
hr = device->SetPixelShaderConstantF(
pshader->GetBaseRegister(profile, i),
parameters->GetConstant(i)->GetData(),
pshader->GetNumRegistersUsed(i));
assertion(hr == D3D_OK, "Failed to set shader constant: %s\n",
DXGetErrorString(hr));
}
SetSamplerState(renderer, pshader, profile, parameters,
renderer->mData->mMaxPShaderImages, 0,
renderer->mData->mCurrentPSState);
}
示例2: sizeof
void StateManager9::setShaderConstants()
{
if (!mDxUniformsDirty)
return;
IDirect3DDevice9 *device = mRenderer9->getDevice();
device->SetVertexShaderConstantF(0, reinterpret_cast<float *>(&mVertexConstants),
sizeof(dx_VertexConstants) / sizeof(float[4]));
device->SetPixelShaderConstantF(0, reinterpret_cast<float *>(&mPixelConstants),
sizeof(dx_PixelConstants) / sizeof(float[4]));
mDxUniformsDirty = false;
}
示例3: saveState
void Blit::saveState()
{
IDirect3DDevice9 *device = getDevice();
HRESULT hr;
device->GetDepthStencilSurface(&mSavedDepthStencil);
device->GetRenderTarget(0, &mSavedRenderTarget);
if (mSavedStateBlock == NULL)
{
hr = device->BeginStateBlock();
ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
setCommonBlitState();
static const float dummyConst[4] = { 0, 0, 0, 0 };
device->SetVertexShader(NULL);
device->SetVertexShaderConstantF(0, dummyConst, 1);
device->SetPixelShader(NULL);
device->SetPixelShaderConstantF(0, dummyConst, 1);
D3DVIEWPORT9 dummyVp;
dummyVp.X = 0;
dummyVp.Y = 0;
dummyVp.Width = 1;
dummyVp.Height = 1;
dummyVp.MinZ = 0;
dummyVp.MaxZ = 1;
device->SetViewport(&dummyVp);
device->SetTexture(0, NULL);
device->SetStreamSource(0, mQuadVertexBuffer, 0, 0);
device->SetVertexDeclaration(mQuadVertexDeclaration);
hr = device->EndStateBlock(&mSavedStateBlock);
ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
}
ASSERT(mSavedStateBlock != NULL);
if (mSavedStateBlock != NULL)
{
hr = mSavedStateBlock->Capture();
ASSERT(SUCCEEDED(hr));
}
}
示例4: GPUAssert
void GPUContextDX9::bindConstant( size_t inIndex, const float4& inValue )
{
HRESULT result = _device->SetPixelShaderConstantF( inIndex, (const float*)&inValue, 1 );
GPUAssert( !FAILED(result), "SetPixelShaderConstantF failed" );
}