74 ID3D10Blob* vertexShaderBuffer = NULL;
75 ID3D10Blob* pixelShaderBuffer = NULL;
77 D3D11_INPUT_ELEMENT_DESC polygonLayout[2];
78 D3D11_BUFFER_DESC textureBufferDesc;
79 unsigned int numElements;
80 D3D11_SAMPLER_DESC samplerDesc;
86 "TextureVertexShader",
92 return CO_E_ERRORINAPP;
105 return CO_E_ERRORINAPP;
108 result = device->CreateVertexShader(
109 vertexShaderBuffer->GetBufferPointer(),
110 vertexShaderBuffer->GetBufferSize(),
117 return CO_E_ERRORINAPP;
120 result = device->CreatePixelShader(
121 pixelShaderBuffer->GetBufferPointer(),
122 pixelShaderBuffer->GetBufferSize(),
129 return CO_E_ERRORINAPP;
132 polygonLayout[0].SemanticName =
"POSITION";
133 polygonLayout[0].SemanticIndex = 0;
134 polygonLayout[0].Format = DXGI_FORMAT_R32G32B32_FLOAT;
135 polygonLayout[0].InputSlot = 0;
136 polygonLayout[0].AlignedByteOffset = 0;
137 polygonLayout[0].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
138 polygonLayout[0].InstanceDataStepRate = 0;
140 polygonLayout[1].SemanticName =
"TEXCOORD";
141 polygonLayout[1].SemanticIndex = 0;
142 polygonLayout[1].Format = DXGI_FORMAT_R32G32_FLOAT;
143 polygonLayout[1].InputSlot = 0;
144 polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
145 polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
146 polygonLayout[1].InstanceDataStepRate = 0;
148 numElements =
sizeof(polygonLayout) /
sizeof(polygonLayout[0]);
150 result = device->CreateInputLayout(
153 vertexShaderBuffer->GetBufferPointer(),
154 vertexShaderBuffer->GetBufferSize(),
160 return CO_E_ERRORINAPP;
163 CHECKED_RELEASE(vertexShaderBuffer);
164 CHECKED_RELEASE(pixelShaderBuffer);
167 textureBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
168 textureBufferDesc.ByteWidth =
sizeof(TextureBufferType);
169 textureBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
170 textureBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
171 textureBufferDesc.MiscFlags = 0;
172 textureBufferDesc.StructureByteStride = 0;
174 result = device->CreateBuffer(
182 return CO_E_ERRORINAPP;
184 samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
185 samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
186 samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
187 samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
188 samplerDesc.MipLODBias = 0.0f;
189 samplerDesc.MaxAnisotropy = 1;
190 samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
191 samplerDesc.BorderColor[0] = 0;
192 samplerDesc.BorderColor[1] = 0;
193 samplerDesc.BorderColor[2] = 0;
194 samplerDesc.BorderColor[3] = 0;
195 samplerDesc.MinLOD = 0;
196 samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
198 result = device->CreateSamplerState(
205 return CO_E_ERRORINAPP;