Minor C++11 code cleanup
Used range-based for loop where it was trivial to do so.
This change should be noop in terms of functionality.
Change-Id: I3d692cc2706f35f5b710e7539fa084365cf28af1
Reviewed-on: https://swiftshader-review.googlesource.com/14628
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Shader/VertexShader.cpp b/src/Shader/VertexShader.cpp
index 260ee4f..ebdfc97 100644
--- a/src/Shader/VertexShader.cpp
+++ b/src/Shader/VertexShader.cpp
@@ -233,9 +233,9 @@
output[Pos][2] = Semantic(Shader::USAGE_POSITION, 0);
output[Pos][3] = Semantic(Shader::USAGE_POSITION, 0);
- for(unsigned int i = 0; i < instruction.size(); i++)
+ for(const auto &inst : instruction)
{
- const DestinationParameter &dst = instruction[i]->dst;
+ const DestinationParameter &dst = inst->dst;
switch(dst.type)
{
@@ -285,15 +285,15 @@
}
else // Shader Model 3.0 input declaration
{
- for(unsigned int i = 0; i < instruction.size(); i++)
+ for(const auto &inst : instruction)
{
- if(instruction[i]->opcode == Shader::OPCODE_DCL &&
- instruction[i]->dst.type == Shader::PARAMETER_OUTPUT)
+ if(inst->opcode == Shader::OPCODE_DCL &&
+ inst->dst.type == Shader::PARAMETER_OUTPUT)
{
- unsigned char usage = instruction[i]->usage;
- unsigned char usageIndex = instruction[i]->usageIndex;
+ unsigned char usage = inst->usage;
+ unsigned char usageIndex = inst->usageIndex;
- const DestinationParameter &dst = instruction[i]->dst;
+ const DestinationParameter &dst = inst->dst;
if(dst.x) output[dst.index][0] = Semantic(usage, usageIndex);
if(dst.y) output[dst.index][1] = Semantic(usage, usageIndex);
@@ -318,11 +318,12 @@
{
textureSampling = false;
- for(unsigned int i = 0; i < instruction.size() && !textureSampling; i++)
+ for(const auto &inst : instruction)
{
- if(instruction[i]->src[1].type == PARAMETER_SAMPLER)
+ if(inst->src[1].type == PARAMETER_SAMPLER)
{
textureSampling = true;
+ break;
}
}
}