• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ MYGUI_PLATFORM_ASSERT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中MYGUI_PLATFORM_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ MYGUI_PLATFORM_ASSERT函数的具体用法?C++ MYGUI_PLATFORM_ASSERT怎么用?C++ MYGUI_PLATFORM_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了MYGUI_PLATFORM_ASSERT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: destroy

	void DirectX11Texture::createManual(int _width, int _height, TextureUsage _usage, PixelFormat _format)
	{
		destroy();

		D3D11_TEXTURE2D_DESC desc;
		desc.ArraySize = 1;
		desc.Width = mWidth = _width;
		desc.Height = mHeight = _height;
		desc.MipLevels = 1;
		desc.SampleDesc.Count = 1;
		desc.SampleDesc.Quality = 0;
		desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
		desc.Usage = D3D11_USAGE_DEFAULT;
		if (_usage == TextureUsage::RenderTarget)
			desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
		else
			desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
		desc.CPUAccessFlags = 0;
		desc.MiscFlags = 0;
		HRESULT hr = mManager->mpD3DDevice->CreateTexture2D(&desc, 0, &mTexture);
		MYGUI_PLATFORM_ASSERT(hr == S_OK, "Create Texture failed!");

		D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
		srvDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
		srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
		srvDesc.Texture2D.MipLevels = 1;
		srvDesc.Texture2D.MostDetailedMip = 0;

		hr = mManager->mpD3DDevice->CreateShaderResourceView(mTexture, &srvDesc, &mResourceView);
		MYGUI_PLATFORM_ASSERT(hr == S_OK, "Create Shader ResourceView failed!");
	}
开发者ID:dayongxie,项目名称:MyGUI,代码行数:31,代码来源:MyGUI_DirectX11Texture.cpp


示例2: MYGUI_PLATFORM_ASSERT

	Vertex* OpenGLESVertexBuffer::lock()
	{
		MYGUI_PLATFORM_ASSERT(mBufferID, "Vertex buffer in not created");

		// Use glMapBuffer
		//glBindBufferARB(GL_ARRAY_BUFFER_ARB, mBufferID);
        glBindBuffer(GL_ARRAY_BUFFER, mBufferID);
        //CHECK_GL_ERROR_DEBUG();
        
        GLenum __error = glGetError();
        if(__error)
        {
            MYGUI_PLATFORM_LOG(Info, "OpenGL error " << __error << " in " << __FILE__<< " " << __FUNCTION__<< " "<< __LINE__);
        }
        assert(__error==0);

		// Discard the buffer
		//glBufferDataARB(GL_ARRAY_BUFFER_ARB, mSizeInBytes, 0, GL_STREAM_DRAW_ARB);
        glBufferData(GL_ARRAY_BUFFER, mSizeInBytes, 0, GL_STREAM_DRAW);
        CHECK_GL_ERROR_DEBUG();


		Vertex* pBuffer = (Vertex*)glMapBufferOES(GL_ARRAY_BUFFER, GL_WRITE_ONLY_OES);
        CHECK_GL_ERROR_DEBUG();

		MYGUI_PLATFORM_ASSERT(pBuffer, "Error lock vertex buffer");

		glBindBuffer(GL_ARRAY_BUFFER, 0);
        CHECK_GL_ERROR_DEBUG();

		return pBuffer;
	}
开发者ID:anyexxx,项目名称:mygui-openglesplatform,代码行数:32,代码来源:MyGUI_OpenGLESVertexBuffer.cpp


示例3: MYGUI_PLATFORM_ASSERT

	void OpenGLVertexBuffer::unlock()
	{
		MYGUI_PLATFORM_ASSERT(mBufferID, "Vertex buffer in not created");

		glBindBuffer(GL_ARRAY_BUFFER, mBufferID);
		GLboolean result = glUnmapBuffer(GL_ARRAY_BUFFER);
		glBindBuffer(GL_ARRAY_BUFFER, 0);

		MYGUI_PLATFORM_ASSERT(result, "Error unlock vertex buffer");
	}
开发者ID:Digmaster,项目名称:mygui,代码行数:10,代码来源:MyGUI_OpenGLVertexBuffer.cpp


示例4: MYGUI_PLATFORM_ASSERT

	void Cocos2dRenderManager::initialise()
	{
		CCDirector *pDirector = CCDirector::sharedDirector();
		MYGUI_PLATFORM_ASSERT(!mIsInitialise, getClassTypeName() << " initialised twice");
		MYGUI_PLATFORM_LOG(Info, "* Initialise: " << getClassTypeName());

		CCSize s = pDirector->getWinSizeInPixels();

		this->setPosition(0, 0);
		this->setContentSize(s);
		setViewSize(int(s.width), int(s.height));

		// 绑定到cocos2d节点
		pDirector->setNotificationNode(this);

		mInfo.pixWidth = s.width;
		mInfo.pixHeight = s.height;

		mVertexFormat = VertexColourType::ColourABGR;

		mUpdate = true;

		kmMat4 tmp;
		kmGLGetMatrix(KM_GL_PROJECTION, &tmp);
		kmMat4Inverse(&mMatrix, &tmp);

		MYGUI_PLATFORM_LOG(Info, getClassTypeName() << " successfully initialized");
		mIsInitialise = true;

		CCNotificationCenter::sharedNotificationCenter()->addObserver(this,
			callfuncO_selector(Cocos2dRenderManager::listenForeToBackground),
			EVENT_COME_TO_BACKGROUND,
			NULL);
		pDirector->getScheduler()->scheduleUpdateForTarget(this, kCCPriorityNonSystemMin, false);
	}
开发者ID:dayongxie,项目名称:MyGUI,代码行数:35,代码来源:MyGUI_Cocos2dRenderManager.cpp


示例5: MYGUI_PLATFORM_ASSERT

	void DirectXRenderManager::initialise(IDirect3DDevice9* _device)
	{
		MYGUI_PLATFORM_ASSERT(!mIsInitialise, getClassTypeName() << " initialised twice");
		MYGUI_PLATFORM_LOG(Info, "* Initialise: " << getClassTypeName());

		mpD3DDevice = _device;

		mVertexFormat = VertexColourType::ColourARGB;

		memset(&mInfo, 0, sizeof(mInfo));
		if (mpD3DDevice != nullptr)
		{
			D3DVIEWPORT9 vp;
			mpD3DDevice->GetViewport(&vp);
			setViewSize(vp.Width, vp.Height);
		}

		mUpdate = false;

		if (mpD3DDevice != nullptr)
		{
			D3DCAPS9 caps;
			mpD3DDevice->GetDeviceCaps(&caps);
			if (caps.TextureCaps & D3DPTEXTURECAPS_SQUAREONLY)
			{
				MYGUI_PLATFORM_LOG(Warning, "Non-squared textures not supported.");
			}
		}

		MYGUI_PLATFORM_LOG(Info, getClassTypeName() << " successfully initialized");
		mIsInitialise = true;
	}
开发者ID:chhawk,项目名称:MyGUI,代码行数:32,代码来源:MyGUI_DirectXRenderManager.cpp


示例6: mOldDepthStencil

	DirectX11RTTexture::DirectX11RTTexture( DirectX11Texture* _texture, DirectX11RenderManager* _manager ) :
		mOldDepthStencil(nullptr),
		mOldRenderTarget(nullptr),
		mTexture(_texture),
		mManager(_manager),
		mRenderTarget(nullptr)
	{
		int width = mTexture->getWidth();
		int height = mTexture->getHeight();

		mRenderTargetInfo.maximumDepth = 0.0f;
		mRenderTargetInfo.hOffset = 0.0f;
		mRenderTargetInfo.vOffset = 0.0f;
		mRenderTargetInfo.aspectCoef = float(height) / float(width);
		mRenderTargetInfo.pixScaleX = 1.0f / float(width);
		mRenderTargetInfo.pixScaleY = 1.0f / float(height);

		D3D11_RENDER_TARGET_VIEW_DESC desc;
		desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
		desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
		desc.Texture2D.MipSlice = 0;

		HRESULT hr = mManager->mpD3DDevice->CreateRenderTargetView(mTexture->mTexture, 0, &mRenderTarget);
		MYGUI_PLATFORM_ASSERT(hr == S_OK, "Create Render Target View failed!");
	}
开发者ID:Anomalous-Software,项目名称:mygui,代码行数:25,代码来源:MyGUI_DirectX11RTTexture.cpp


示例7: glBindTexture

	void OpenGLTexture::unlock()
	{
		if (!mLock && mBuffer)
		{
			delete mBuffer;
			mBuffer = 0;

			glBindTexture(GL_TEXTURE_2D, 0);

			return;
		}

		MYGUI_PLATFORM_ASSERT(mLock, "Texture is not locked");

		// release the mapped buffer
		glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB);

		// copy pixels from PBO to texture object
		// Use offset instead of ponter.
		glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, mWidth, mHeight, mPixelFormat, GL_UNSIGNED_BYTE, 0);

		// it is good idea to release PBOs with ID 0 after use.
		// Once bound with 0, all pixel operations are back to normal ways.
		glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);

		glBindTexture(GL_TEXTURE_2D, 0);

		mBuffer = 0;
		mLock = false;
	}
开发者ID:siangzhang,项目名称:starworld,代码行数:30,代码来源:MyGUI_OpenGLTexture.cpp


示例8: initialise

    void initialise(Ogre::RenderWindow* _window, Ogre::SceneManager* _scene)
    {
        MYGUI_PLATFORM_ASSERT(!mIsInitialise, getClassTypeName() << " initialised twice");
        MYGUI_PLATFORM_LOG(Info, "* Initialise: " << getClassTypeName());

        mColorBlendMode.blendType = Ogre::LBT_COLOUR;
        mColorBlendMode.source1 = Ogre::LBS_TEXTURE;
        mColorBlendMode.source2 = Ogre::LBS_DIFFUSE;
        mColorBlendMode.operation = Ogre::LBX_MODULATE;

        mAlphaBlendMode.blendType = Ogre::LBT_ALPHA;
        mAlphaBlendMode.source1 = Ogre::LBS_TEXTURE;
        mAlphaBlendMode.source2 = Ogre::LBS_DIFFUSE;
        mAlphaBlendMode.operation = Ogre::LBX_MODULATE;

        mTextureAddressMode.u = Ogre::TextureUnitState::TAM_CLAMP;
        mTextureAddressMode.v = Ogre::TextureUnitState::TAM_CLAMP;
        mTextureAddressMode.w = Ogre::TextureUnitState::TAM_CLAMP;

        mSceneManager = nullptr;
        mWindow = nullptr;
        mUpdate = false;
        mRenderSystem = nullptr;
        mActiveViewport = 0;

        Ogre::Root* root = Ogre::Root::getSingletonPtr();
        if (root != nullptr)
            setRenderSystem(root->getRenderSystem());
        setRenderWindow(_window);
        setSceneManager(_scene);


        MYGUI_PLATFORM_LOG(Info, getClassTypeName() << " successfully initialized");
        mIsInitialise = true;
    }
开发者ID:Allxere,项目名称:openmw,代码行数:35,代码来源:manager.cpp


示例9: MYGUI_PLATFORM_ASSERT

	void DirectX11DataManager::initialise()
	{
		MYGUI_PLATFORM_ASSERT(!mIsInitialise, getClassTypeName() << " initialised twice");
		MYGUI_PLATFORM_LOG(Info, "* Initialise: " << getClassTypeName());

		MYGUI_PLATFORM_LOG(Info, getClassTypeName() << " successfully initialized");
		mIsInitialise = true;
	}
开发者ID:dayongxie,项目名称:MyGUI,代码行数:8,代码来源:MyGUI_DirectX11DataManager.cpp


示例10: initialise

    void initialise(Ogre::RenderWindow* _window, Ogre::SceneManager* _scene)
    {
        MYGUI_PLATFORM_ASSERT(!mIsInitialise, getClassTypeName() << " initialised twice");
        MYGUI_PLATFORM_LOG(Info, "* Initialise: " << getClassTypeName());

        mColorBlendMode.blendType = Ogre::LBT_COLOUR;
        mColorBlendMode.source1 = Ogre::LBS_TEXTURE;
        mColorBlendMode.source2 = Ogre::LBS_DIFFUSE;
        mColorBlendMode.operation = Ogre::LBX_MODULATE;

        mAlphaBlendMode.blendType = Ogre::LBT_ALPHA;
        mAlphaBlendMode.source1 = Ogre::LBS_TEXTURE;
        mAlphaBlendMode.source2 = Ogre::LBS_DIFFUSE;
        mAlphaBlendMode.operation = Ogre::LBX_MODULATE;

        mTextureAddressMode.u = Ogre::TextureUnitState::TAM_CLAMP;
        mTextureAddressMode.v = Ogre::TextureUnitState::TAM_CLAMP;
        mTextureAddressMode.w = Ogre::TextureUnitState::TAM_CLAMP;

        mSceneManager = nullptr;
        mWindow = nullptr;
        mUpdate = false;
        mRenderSystem = nullptr;
        mActiveViewport = 0;

        Ogre::Root* root = Ogre::Root::getSingletonPtr();
        if (root != nullptr)
            setRenderSystem(root->getRenderSystem());
        setRenderWindow(_window);
        setSceneManager(_scene);

        // ADDED
        sh::MaterialInstance* mat = sh::Factory::getInstance().getMaterialInstance("MyGUI/NoTexture");
        sh::Factory::getInstance()._ensureMaterial("MyGUI/NoTexture", "Default");
        mVertexProgramNoTexture = static_cast<sh::OgreMaterial*>(mat->getMaterial())->getOgreTechniqueForConfiguration("Default")->getPass(0)
                                  ->getVertexProgram()->_getBindingDelegate();

        mat = sh::Factory::getInstance().getMaterialInstance("MyGUI/OneTexture");
        sh::Factory::getInstance()._ensureMaterial("MyGUI/OneTexture", "Default");
        mVertexProgramOneTexture = static_cast<sh::OgreMaterial*>(mat->getMaterial())->getOgreTechniqueForConfiguration("Default")->getPass(0)
                                   ->getVertexProgram()->_getBindingDelegate();

        mat = sh::Factory::getInstance().getMaterialInstance("MyGUI/NoTexture");
        sh::Factory::getInstance()._ensureMaterial("MyGUI/NoTexture", "Default");
        mFragmentProgramNoTexture = static_cast<sh::OgreMaterial*>(mat->getMaterial())->getOgreTechniqueForConfiguration("Default")->getPass(0)
                                    ->getFragmentProgram()->_getBindingDelegate();

        mat = sh::Factory::getInstance().getMaterialInstance("MyGUI/OneTexture");
        sh::Factory::getInstance()._ensureMaterial("MyGUI/OneTexture", "Default");
        mFragmentProgramOneTexture = static_cast<sh::OgreMaterial*>(mat->getMaterial())->getOgreTechniqueForConfiguration("Default")->getPass(0)
                                     ->getFragmentProgram()->_getBindingDelegate();



        MYGUI_PLATFORM_LOG(Info, getClassTypeName() << " successfully initialized");
        mIsInitialise = true;
    }
开发者ID:jhooks1,项目名称:openmw,代码行数:57,代码来源:manager.cpp


示例11: createTexture

    ITexture* createTexture(const std::string& _name)
    {
        MapTexture::const_iterator item = mTextures.find(_name);
        MYGUI_PLATFORM_ASSERT(item == mTextures.end(), "Texture '" << _name << "' already exist");

        OgreTexture* texture = new OgreTexture(_name, OgreDataManager::getInstance().getGroup());
        mTextures[_name] = texture;
        return texture;
    }
开发者ID:jhooks1,项目名称:openmw,代码行数:9,代码来源:manager.cpp


示例12: MYGUI_PLATFORM_ASSERT

	ITexture* OpenGLRenderManager::createTexture(const std::string& _name)
	{
		MapTexture::const_iterator item = mTextures.find(_name);
		MYGUI_PLATFORM_ASSERT(item == mTextures.end(), "Texture '" << _name << "' already exist");

		OpenGLTexture* texture = new OpenGLTexture(_name, mImageLoader);
		mTextures[_name] = texture;
		return texture;
	}
开发者ID:IsemanTech,项目名称:mygui,代码行数:9,代码来源:MyGUI_OpenGLRenderManager.cpp


示例13: destroyTexture

    void destroyTexture(ITexture* _texture)
    {
        if (_texture == nullptr) return;

        MapTexture::iterator item = mTextures.find(_texture->getName());
        MYGUI_PLATFORM_ASSERT(item != mTextures.end(), "Texture '" << _texture->getName() << "' not found");

        mTextures.erase(item);
        delete _texture;
    }
开发者ID:jhooks1,项目名称:openmw,代码行数:10,代码来源:manager.cpp


示例14: sizeof

	bool DirectX11VertexBuffer::create()
	{
		D3D11_BUFFER_DESC desc;
		desc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
		desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
		desc.MiscFlags = 0;
		desc.StructureByteStride = 0;
		desc.ByteWidth = sizeof(Vertex) * (mNeedVertexCount);
		desc.Usage = D3D11_USAGE_DYNAMIC;
		HRESULT hr = mManager->mpD3DDevice->CreateBuffer(&desc, 0, &mBuffer);
		MYGUI_PLATFORM_ASSERT(hr == S_OK, "Create Buffer failed!");
		return hr == S_OK ? true : false;
	}
开发者ID:Anomalous-Software,项目名称:mygui,代码行数:13,代码来源:MyGUI_DirectX11VertexBuffer.cpp


示例15: MYGUI_PLATFORM_ASSERT

	void* OpenGLTexture::lock(TextureUsage _access)
	{
		MYGUI_PLATFORM_ASSERT(mTextureID, "Texture is not created");

		if (_access == TextureUsage::Read)
		{
			glBindTexture(GL_TEXTURE_2D, mTextureID);

			mBuffer = new unsigned char[mDataSize];
			glGetTexImage(GL_TEXTURE_2D, 0, mPixelFormat, GL_UNSIGNED_BYTE, mBuffer);

			mLock = false;

			return mBuffer;
		}

		// bind the texture
		glBindTexture(GL_TEXTURE_2D, mTextureID);
		if (!OpenGLRenderManager::getInstance().isPixelBufferObjectSupported())
		{
			//Fallback if PBO's are not supported
			mBuffer = new unsigned char[mDataSize];
		}
		else
		{
			// bind the PBO
			glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, mPboID);
			
			// Note that glMapBufferARB() causes sync issue.
			// If GPU is working with this buffer, glMapBufferARB() will wait(stall)
			// until GPU to finish its job. To avoid waiting (idle), you can call
			// first glBufferDataARB() with NULL pointer before glMapBufferARB().
			// If you do that, the previous data in PBO will be discarded and
			// glMapBufferARB() returns a new allocated pointer immediately
			// even if GPU is still working with the previous data.
			glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, mDataSize, 0, mUsage);

			// map the buffer object into client's memory
			mBuffer = (GLubyte*)glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, mAccess);
			if (!mBuffer)
			{
				glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
				glBindTexture(GL_TEXTURE_2D, 0);
				MYGUI_PLATFORM_EXCEPT("Error texture lock");
			}
		}

		mLock = true;

		return mBuffer;
	}
开发者ID:podusowski,项目名称:rusted,代码行数:51,代码来源:MyGUI_OpenGLTexture.cpp


示例16: MYGUI_PLATFORM_ASSERT

	void Ogre2DataManager::initialise(const std::string& _group)
	{
		MYGUI_PLATFORM_ASSERT(!mIsInitialise, getClassTypeName() << " initialised twice");
		MYGUI_PLATFORM_LOG(Info, "* Initialise: " << getClassTypeName());

		mGroup = _group;
		if (mGroup == Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME)
			mAllGroups = true;
		else
			mAllGroups = false;

		MYGUI_PLATFORM_LOG(Info, getClassTypeName() << " successfully initialized");
		mIsInitialise = true;
	}
开发者ID:DotWolff,项目名称:mygui,代码行数:14,代码来源:MyGUI_Ogre2DataManager.cpp


示例17: shutdown

    void shutdown()
    {
        MYGUI_PLATFORM_ASSERT(mIsInitialise, getClassTypeName() << " is not initialised");
        MYGUI_PLATFORM_LOG(Info, "* Shutdown: " << getClassTypeName());

        destroyAllResources();

        setSceneManager(nullptr);
        setRenderWindow(nullptr);
        setRenderSystem(nullptr);

        MYGUI_PLATFORM_LOG(Info, getClassTypeName() << " successfully shutdown");
        mIsInitialise = false;
    }
开发者ID:jhooks1,项目名称:openmw,代码行数:14,代码来源:manager.cpp


示例18: MYGUI_PLATFORM_ASSERT

	void DirectX11RenderManager::shutdown()
	{
		MYGUI_PLATFORM_ASSERT(mIsInitialise, getClassTypeName() << " is not initialised");
		MYGUI_PLATFORM_LOG(Info, "* Shutdown: " << getClassTypeName());

		destroyAllResources();

		if ( mVertexShader0 ) mVertexShader0->Release();
		if ( mVertexShader1 ) mVertexShader1->Release();
		if ( mPixelShader0 ) mPixelShader0->Release();
		if ( mPixelShader1 ) mPixelShader1->Release();
		if ( mSamplerState ) mSamplerState->Release();
		if ( mBlendState ) mBlendState->Release();
		if ( mDepthStencilState ) mDepthStencilState->Release();
		if ( mRasterizerState ) mRasterizerState->Release();
		if ( mInputLayout0 ) mInputLayout0->Release();
		if ( mInputLayout1 ) mInputLayout1->Release();

		MYGUI_PLATFORM_LOG(Info, getClassTypeName() << " successfully shutdown");
		mIsInitialise = false;
	}
开发者ID:chhawk,项目名称:MyGUI,代码行数:21,代码来源:MyGUI_DirectX11RenderManager.cpp


示例19: MYGUI_PLATFORM_ASSERT

	void DirectXRenderManager::initialise(IDirect3DDevice9 *_device)
	{
		MYGUI_PLATFORM_ASSERT(false == mIsInitialise, INSTANCE_TYPE_NAME << " initialised twice");
		MYGUI_PLATFORM_LOG(Info, "* Initialise: " << INSTANCE_TYPE_NAME);

		mpD3DDevice = _device;

		mVertexFormat = VertexColourType::ColourARGB;  

		memset(&mInfo, 0, sizeof(mInfo));
		if (mpD3DDevice != nullptr)
		{
			D3DVIEWPORT9 vp;
			mpD3DDevice->GetViewport(&vp);
			setViewSize(vp.Width, vp.Height);
		}

		mUpdate = false;

		MYGUI_PLATFORM_LOG(Info, INSTANCE_TYPE_NAME << " successfully initialized");
		mIsInitialise = true;
	}
开发者ID:sskoruppa,项目名称:Glove_Code,代码行数:22,代码来源:MyGUI_DirectXRenderManager.cpp


示例20: MYGUI_PLATFORM_ASSERT

	void DirectX11RenderManager::initialise(ID3D11Device* _device)
	{
		MYGUI_PLATFORM_ASSERT(!mIsInitialise, getClassTypeName() << " initialised twice");
		MYGUI_PLATFORM_LOG(Info, "* Initialise: " << getClassTypeName());

		mpD3DDevice = _device;
		_device->GetImmediateContext(&mpD3DContext);

		mVertexFormat = VertexColourType::ColourABGR;

		std::string vertexProfile, pixelProfile;
		if ( mpD3DDevice->GetFeatureLevel() == D3D_FEATURE_LEVEL_11_0 )
		{
			vertexProfile = "vs_5_0";
			pixelProfile = "ps_5_0";
		}
		else if ( mpD3DDevice->GetFeatureLevel() == D3D_FEATURE_LEVEL_10_1 )
		{
			vertexProfile = "vs_4_1";
			pixelProfile = "ps_4_1";
		}
		else if ( mpD3DDevice->GetFeatureLevel() == D3D_FEATURE_LEVEL_10_0 )
		{
			vertexProfile = "vs_4_0";
			pixelProfile = "ps_4_0";
		}
		else if ( mpD3DDevice->GetFeatureLevel() == D3D_FEATURE_LEVEL_9_3 )
		{
			vertexProfile = "vs_4_0_level_9_3";
			pixelProfile = "ps_4_0_level_9_3";
		}
		else if ( mpD3DDevice->GetFeatureLevel() == D3D_FEATURE_LEVEL_9_2 )
		{
			vertexProfile = "vs_4_0_level_9_1";
			pixelProfile = "ps_4_0_level_9_1";
		}
		else if ( mpD3DDevice->GetFeatureLevel() == D3D_FEATURE_LEVEL_9_1 )
		{
			vertexProfile = "vs_4_0_level_9_1";
			pixelProfile = "ps_4_0_level_9_1";
		}

		// Get Current viewports
		memset(&mInfo, 0, sizeof(mInfo));
		UINT numViewports = 0;
		D3D11_VIEWPORT viewports[8];

		mpD3DContext->RSGetViewports(&numViewports, viewports);
		MYGUI_PLATFORM_ASSERT(numViewports == 0, getClassTypeName() << " 0 viewport sets");

		setViewSize((int)viewports[0].Width, (int)viewports[0].Height);

		UINT flags = (1 << 11) | (1 << 15);

		// Build Flat Vertex Shader
		ID3DBlob* bytecode = 0, *errors = 0, *signature0 = 0, *signature1 = 0;
		HRESULT hr = D3DCompile(vsSource, strlen(vsSource), "VertexShader0", 0, 0, "main", vertexProfile.c_str(), flags, 0, &bytecode, &errors);
		MYGUI_PLATFORM_ASSERT(hr == S_OK, (errors ? (char*)errors->GetBufferPointer() : "Vertex Shader Compilation failed, unknown errors!"));

		hr = D3DGetInputSignatureBlob(bytecode->GetBufferPointer(), bytecode->GetBufferSize(), &signature0);
		MYGUI_PLATFORM_ASSERT(hr == S_OK, (errors ? (char*)errors->GetBufferPointer() : "Vertex Shader Compilation failed, failed to get input signature!"));

		hr = mpD3DDevice->CreateVertexShader(bytecode->GetBufferPointer(), bytecode->GetBufferSize(), 0, &mVertexShader0);
		MYGUI_PLATFORM_ASSERT(hr == S_OK, (errors ? (char*)errors->GetBufferPointer() : "Vertex Shader Create failed!"));

		if ( bytecode ) bytecode->Release();
		if ( errors ) errors->Release();


		// Build Textured Vertex Shader
		bytecode = 0;
		errors = 0;
		hr = D3DCompile(vsTexturedSource, strlen(vsTexturedSource), "VertexShader1", 0, 0, "main", vertexProfile.c_str(), flags, 0, &bytecode, &errors);
		MYGUI_PLATFORM_ASSERT(hr == S_OK, (errors ? (char*)errors->GetBufferPointer() : "Vertex Shader Compilation failed, unknown errors!"));

		hr = D3DGetInputSignatureBlob(bytecode->GetBufferPointer(), bytecode->GetBufferSize(), &signature1);
		MYGUI_PLATFORM_ASSERT(hr == S_OK, (errors ? (char*)errors->GetBufferPointer() : "Vertex Shader Compilation failed, failed to get input signature!"));

		hr = mpD3DDevice->CreateVertexShader(bytecode->GetBufferPointer(), bytecode->GetBufferSize(), 0, &mVertexShader1);
		MYGUI_PLATFORM_ASSERT(hr == S_OK, (errors ? (char*)errors->GetBufferPointer() : "Vertex Shader Create failed!"));

		if ( bytecode ) bytecode->Release();
		if ( errors ) errors->Release();

		// Build Flat Pixel Shader
		bytecode = 0;
		errors = 0;
		hr = D3DCompile(psSource, strlen(psSource), "PixelShader0", 0, 0, "main", pixelProfile.c_str(), flags, 0, &bytecode, &errors);
		MYGUI_PLATFORM_ASSERT(hr == S_OK, (errors ? (char*)errors->GetBufferPointer() : "Vertex Shader Compilation failed, unknown errors!"));

		hr = mpD3DDevice->CreatePixelShader(bytecode->GetBufferPointer(), bytecode->GetBufferSize(), 0, &mPixelShader0);
		MYGUI_PLATFORM_ASSERT(hr == S_OK, (errors ? (char*)errors->GetBufferPointer() : "Vertex Shader Create failed!"));

		if ( bytecode ) bytecode->Release();
		if ( errors ) errors->Release();


		// Build Textured Pixel Shader
		bytecode = 0;
		errors = 0;
//.........这里部分代码省略.........
开发者ID:Anomalous-Software,项目名称:mygui,代码行数:101,代码来源:MyGUI_DirectX11RenderManager.cpp



注:本文中的MYGUI_PLATFORM_ASSERT函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MYMAX函数代码示例发布时间:2022-05-30
下一篇:
C++ MYGUI_LOG函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap