MCPcopy Create free account
hub / github.com/TheRealMJP/BakingLab / Begin

Method Begin

SampleFramework11/v1.02/Graphics/SpriteRenderer.cpp:196–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

194}
195
196void SpriteRenderer::Begin(ID3D11DeviceContext* deviceContext, FilterMode filterMode, BlendMode blendMode)
197{
198 _ASSERT(initialized);
199 _ASSERT(!context);
200 context = deviceContext;
201
202 D3DPERF_BeginEvent(0xFFFFFFFF, L"SpriteRenderer Begin/End");
203
204 // Set the index buffer
205 context->IASetIndexBuffer(indexBuffer, DXGI_FORMAT_R16_UINT, 0);
206
207 // Set primitive topology
208 context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
209
210 ID3D11BlendState* blendState = blendMode == OpaqueBlend ? opaqueBlendState : alphaBlendState;
211 ID3D11PixelShader* ps = blendMode == OpaqueBlend ? pixelShaderOpaque : pixelShader;
212
213 // Set the states
214 float blendFactor[4] = {1, 1, 1, 1};
215 context->RSSetState(rastState);
216 context->OMSetBlendState(blendState, blendFactor, 0xFFFFFFFF);
217 context->OMSetDepthStencilState(dsState, 0);
218
219 if (filterMode == Linear)
220 context->PSSetSamplers(0, 1, &(linearSamplerState.GetInterfacePtr()));
221 else if (filterMode == Point)
222 context->PSSetSamplers(0, 1, &(pointSamplerState.GetInterfacePtr()));
223
224 // Set the shaders
225 context->PSSetShader(ps, nullptr, 0);
226 context->GSSetShader(nullptr, nullptr, 0);
227 context->DSSetShader(nullptr, nullptr, 0);
228 context->HSSetShader(nullptr, nullptr, 0);
229}
230
231D3D11_TEXTURE2D_DESC SpriteRenderer::SetPerBatchData(ID3D11ShaderResourceView* texture)
232{

Callers 5

RenderMethod · 0.80
RenderHUDMethod · 0.80
RunMethod · 0.80
RenderTextMethod · 0.80
StartProfileMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected