| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
| 3 * All rights reserved. | 3 * All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 */ | 30 */ |
| 31 | 31 |
| 32 | 32 |
| 33 // This file contains the implementation of the SamplerCB class. | 33 // This file contains the implementation of the SamplerCB class. |
| 34 | 34 |
| 35 #include "core/cross/precompile.h" | 35 #include "core/cross/precompile.h" |
| 36 #include "core/cross/error.h" | 36 #include "core/cross/error.h" |
| 37 #include "core/cross/command_buffer/sampler_cb.h" | 37 #include "core/cross/command_buffer/sampler_cb.h" |
| 38 #include "core/cross/command_buffer/renderer_cb.h" | 38 #include "core/cross/command_buffer/renderer_cb.h" |
| 39 #include "command_buffer/common/cross/cmd_buffer_format.h" | 39 #include "command_buffer/common/cross/o3d_cmd_format.h" |
| 40 #include "command_buffer/client/cross/o3d_cmd_helper.h" | 40 #include "command_buffer/client/cross/o3d_cmd_helper.h" |
| 41 | 41 |
| 42 namespace o3d { | 42 namespace o3d { |
| 43 | 43 |
| 44 using command_buffer::CommandBufferEntry; | 44 using command_buffer::CommandBufferEntry; |
| 45 using command_buffer::O3DCmdHelper; | 45 using command_buffer::O3DCmdHelper; |
| 46 using command_buffer::ResourceId; | 46 using command_buffer::ResourceId; |
| 47 namespace sampler = command_buffer::sampler; | 47 namespace sampler = command_buffer::sampler; |
| 48 | 48 |
| 49 namespace { | 49 namespace { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 O3DCmdHelper* helper = renderer_->helper(); | 97 O3DCmdHelper* helper = renderer_->helper(); |
| 98 sampler::AddressingMode address_mode_u_cb = AddressModeToCB(address_mode_u()); | 98 sampler::AddressingMode address_mode_u_cb = AddressModeToCB(address_mode_u()); |
| 99 sampler::AddressingMode address_mode_v_cb = AddressModeToCB(address_mode_v()); | 99 sampler::AddressingMode address_mode_v_cb = AddressModeToCB(address_mode_v()); |
| 100 sampler::AddressingMode address_mode_w_cb = AddressModeToCB(address_mode_w()); | 100 sampler::AddressingMode address_mode_w_cb = AddressModeToCB(address_mode_w()); |
| 101 sampler::FilteringMode mag_filter_cb = FilterTypeToCB(mag_filter()); | 101 sampler::FilteringMode mag_filter_cb = FilterTypeToCB(mag_filter()); |
| 102 sampler::FilteringMode min_filter_cb = FilterTypeToCB(min_filter()); | 102 sampler::FilteringMode min_filter_cb = FilterTypeToCB(min_filter()); |
| 103 sampler::FilteringMode mip_filter_cb = FilterTypeToCB(mip_filter()); | 103 sampler::FilteringMode mip_filter_cb = FilterTypeToCB(mip_filter()); |
| 104 if (mag_filter_cb == sampler::kNone) mag_filter_cb = sampler::kPoint; | 104 if (mag_filter_cb == sampler::kNone) mag_filter_cb = sampler::kPoint; |
| 105 if (min_filter_cb == sampler::kNone) min_filter_cb = sampler::kPoint; | 105 if (min_filter_cb == sampler::kNone) min_filter_cb = sampler::kPoint; |
| 106 int max_max_anisotropy = | 106 int max_max_anisotropy = |
| 107 command_buffer::cmd::SetSamplerStates::MaxAnisotropy::kMask; | 107 command_buffer::o3d::SetSamplerStates::MaxAnisotropy::kMask; |
| 108 unsigned int max_anisotropy_cb = | 108 unsigned int max_anisotropy_cb = |
| 109 std::max(1, std::min(max_max_anisotropy, max_anisotropy())); | 109 std::max(1, std::min(max_max_anisotropy, max_anisotropy())); |
| 110 if (min_filter() != Sampler::ANISOTROPIC) { | 110 if (min_filter() != Sampler::ANISOTROPIC) { |
| 111 max_anisotropy_cb = 1; | 111 max_anisotropy_cb = 1; |
| 112 } | 112 } |
| 113 helper->SetSamplerStates( | 113 helper->SetSamplerStates( |
| 114 resource_id_, | 114 resource_id_, |
| 115 address_mode_u_cb, | 115 address_mode_u_cb, |
| 116 address_mode_v_cb, | 116 address_mode_v_cb, |
| 117 address_mode_w_cb, | 117 address_mode_w_cb, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 135 } | 135 } |
| 136 | 136 |
| 137 if (texture_object) { | 137 if (texture_object) { |
| 138 helper->SetSamplerTexture( | 138 helper->SetSamplerTexture( |
| 139 resource_id_, | 139 resource_id_, |
| 140 reinterpret_cast<uint32>(texture_object->GetTextureHandle())); | 140 reinterpret_cast<uint32>(texture_object->GetTextureHandle())); |
| 141 } | 141 } |
| 142 } | 142 } |
| 143 | 143 |
| 144 } // namespace o3d | 144 } // namespace o3d |
| OLD | NEW |