bool InitResourceDX10(void) { g_pDevice = GutGetGraphicsDeviceDX10(); ID3D10Blob *pVSCode = NULL; for ( int i=0; i<NUM_FRAMEBUFFERS; i++ ) { g_pTextures[i] = NULL; g_pSRView[i] = NULL; g_pRTView[i] = NULL; } // 載入Shader { g_pPostFX = GutLoadFXShaderDX10("../../shaders/Posteffect_dx10.fx"); if ( NULL==g_pPostFX ) return false; g_pExposureFX = GutLoadFXShaderDX10("../../shaders/Exposure_dx10.fx"); if ( NULL==g_pExposureFX ) return false; } // 設定Vertex資料格式 { ID3D10EffectTechnique *pShader = g_pExposureFX->GetTechniqueByName("AutoExposure"); D3D10_INPUT_ELEMENT_DESC layout[] = { { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 }, { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D10_INPUT_PER_VERTEX_DATA, 0 } }; D3D10_PASS_DESC PassDesc; pShader->GetPassByIndex(0)->GetDesc(&PassDesc); if ( D3D_OK != g_pDevice->CreateInputLayout( layout, 2, PassDesc.pIAInputSignature, PassDesc.IAInputSignatureSize, &g_pVertexLayout ) ) return false; SAFE_RELEASE(pVSCode); } if ( !ReInitResourceDX10() ) return false; CGutModel_DX10::LoadDefaultShader("../../shaders/gmodel_dx10.hlsl"); g_Model_DX10.ConvertToDX10Model(&g_Model); g_pVertexBuffer = GutCreateVertexBuffer_DX10(sizeof(Vertex_VT)*4, g_FullScreenQuad); return true; }
bool InitResourceDX10(void) { g_pDevice = GutGetGraphicsDeviceDX10(); // 載入Shader { g_pRefractionFX = GutLoadFXShaderDX10("../../shaders/Refraction_dx10.fx"); if ( NULL==g_pRefractionFX ) return false; ID3D10EffectTechnique *pShader = g_pRefractionFX->GetTechniqueByName("Refraction"); const sVertexDecl *pVertexDecl = g_Model.GetVertexFormat(); D3D10_PASS_DESC PassDesc; pShader->GetPassByIndex(0)->GetDesc(&PassDesc); g_pRefractionLayout = GutCreateInputLayoutDX10(pVertexDecl, PassDesc.pIAInputSignature, PassDesc.IAInputSignatureSize); } g_pPostFX = GutLoadFXShaderDX10("../../shaders/Posteffect_dx10.fx"); if ( NULL==g_pPostFX ) return false; { g_pVertexBuffer = GutCreateVertexBuffer_DX10(sizeof(Vertex_VT)*4, g_FullScreenQuad); D3D10_INPUT_ELEMENT_DESC layout[] = { { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 }, { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D10_INPUT_PER_VERTEX_DATA, 0 } }; ID3D10EffectTechnique *pShader = g_pPostFX->GetTechniqueByName("DrawIcon"); D3D10_PASS_DESC PassDesc; pShader->GetPassByIndex(0)->GetDesc(&PassDesc); if ( D3D_OK != g_pDevice->CreateInputLayout( layout, 2, PassDesc.pIAInputSignature, PassDesc.IAInputSignatureSize, &g_pVertexLayout ) ) return false; } if ( !ReInitResourceDX10() ) return false; CGutModel_DX10::LoadDefaultShader("../../shaders/gmodel_dx10.hlsl"); g_Model_DX10.ConvertToDX10Model(&g_Model); g_pTexture = GutLoadTexture_DX10("../../textures/lena.dds"); return true; }
void ResizeWindowDX10(int width, int height) { GutResetGraphicsDeviceDX10(); ReInitResourceDX10(); }