std::string str = arrows[level];
str += desc.name;
char hier[80];
- strcpy_s(hier, sizeof(hier), str.c_str());
+ strcpy_s(hier, sizeof(hier)-1, str.c_str());
// print out
fprintf(f,
pContext->workerPrivateState = *pCreateInfo->pWorkerPrivateState;
}
- memset(&pContext->WaitLock, 0, sizeof(pContext->WaitLock));
- memset(&pContext->FifosNotEmpty, 0, sizeof(pContext->FifosNotEmpty));
+ memset((void*)&pContext->WaitLock, 0, sizeof(pContext->WaitLock));
+ memset((void*)&pContext->FifosNotEmpty, 0, sizeof(pContext->FifosNotEmpty));
new (&pContext->WaitLock) std::mutex();
new (&pContext->FifosNotEmpty) std::condition_variable();
void CopyState(DRAW_STATE& dst, const DRAW_STATE& src)
{
- memcpy(&dst.state, &src.state, sizeof(API_STATE));
+ memcpy((void*)&dst.state, (void*)&src.state, sizeof(API_STATE));
}
template <bool IsDraw>
auto pDst = GetDrawState(pContext);
assert(pStateBlock && memSize >= sizeof(*pDst));
- memcpy(pDst, pStateBlock, sizeof(*pDst));
+ memcpy((void*)pDst, (void*)pStateBlock, sizeof(*pDst));
}
void SetupDefaultState(SWR_CONTEXT* pContext)
SWR_CONTEXT* pContext = GetContext(hContext);
API_STATE* pState = GetDrawState(pContext);
- memcpy(&pState->rastState, pRastState, sizeof(SWR_RASTSTATE));
+ memcpy((void*)&pState->rastState, (void*)pRastState, sizeof(SWR_RASTSTATE));
}
void SwrSetViewports(HANDLE hContext,
{
gt_pTessellationThreadData =
(TessellationThreadLocalData*)AlignedMalloc(sizeof(TessellationThreadLocalData), 64);
- memset(gt_pTessellationThreadData, 0, sizeof(*gt_pTessellationThreadData));
+ memset((void*)gt_pTessellationThreadData, 0, sizeof(*gt_pTessellationThreadData));
}
}
mNumEntries = numEntries;
mpRingBuffer = (T*)AlignedMalloc(sizeof(T) * numEntries, 64);
SWR_ASSERT(mpRingBuffer != nullptr);
- memset(mpRingBuffer, 0, sizeof(T) * numEntries);
+ memset((void*)mpRingBuffer, 0, sizeof(T) * numEntries);
}
void Destroy()
return (uint16_t)tmpVal;
}
- //////////////////////////////////////////////////////////////////////////
- /// @brief Convert an IEEE 754 16-bit float to an 32-bit single precision
- /// float
- /// @param val - 16-bit float
- /// @todo Maybe move this outside of this file into a header?
- static float ConvertFloat16ToFloat32(uint32_t val)
- {
- uint32_t result;
- if ((val & 0x7fff) == 0)
- {
- result = ((uint32_t)(val & 0x8000)) << 16;
- }
- else if ((val & 0x7c00) == 0x7c00)
- {
- result = ((val & 0x3ff) == 0) ? 0x7f800000 : 0x7fc00000;
- result |= ((uint32_t)val & 0x8000) << 16;
- }
- else
- {
- uint32_t sign = (val & 0x8000) << 16;
- uint32_t mant = (val & 0x3ff) << 13;
- uint32_t exp = (val >> 10) & 0x1f;
- if ((exp == 0) && (mant != 0)) // Adjust exponent and mantissa for denormals
- {
- mant <<= 1;
- while (mant < (0x400 << 13))
- {
- exp--;
- mant <<= 1;
- }
- mant &= (0x3ff << 13);
- }
- exp = ((exp - 15 + 127) & 0xff) << 23;
- result = sign | exp | mant;
- }
-
- return *(float*)&result;
- }
-
Constant* Builder::C(bool i) { return ConstantInt::get(IRB()->getInt1Ty(), (i ? 1 : 0)); }
Constant* Builder::C(char i) { return ConstantInt::get(IRB()->getInt8Ty(), i); }
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
-*
+*
* @file StoreTile.h
-*
+*
* @brief Functionality for Store.
-*
+*
******************************************************************************/
#pragma once
{
static const uint32_t MAX_RASTER_TILE_BYTES = 16 * 16; // 16 pixels * 16 bytes per pixel
- OSALIGNSIMD16(uint8_t) soaTile[MAX_RASTER_TILE_BYTES];
- OSALIGNSIMD16(uint8_t) aosTile[MAX_RASTER_TILE_BYTES];
+ OSALIGNSIMD16(uint8_t) soaTile[MAX_RASTER_TILE_BYTES] = {0};
+ OSALIGNSIMD16(uint8_t) aosTile[MAX_RASTER_TILE_BYTES] = {0};
// Convert from SrcFormat --> DstFormat
simd16vector src;
static const uint32_t offset = sizeof(simdscalar);
// swizzle rgba -> bgra while we load
- simdscalar vComp0 = _simd_load_ps((const float*)(pSrc + (FormatTraits<DstFormat>::swizzle(0))*offset)); // float32 rrrrrrrr
+ simdscalar vComp0 = _simd_load_ps((const float*)(pSrc + (FormatTraits<DstFormat>::swizzle(0))*offset)); // float32 rrrrrrrr
simdscalar vComp1 = _simd_load_ps((const float*)(pSrc + (FormatTraits<DstFormat>::swizzle(1))*offset)); // float32 gggggggg
- simdscalar vComp2 = _simd_load_ps((const float*)(pSrc + (FormatTraits<DstFormat>::swizzle(2))*offset)); // float32 bbbbbbbb
- simdscalar vComp3 = _simd_load_ps((const float*)(pSrc + (FormatTraits<DstFormat>::swizzle(3))*offset)); // float32 aaaaaaaa
+ simdscalar vComp2 = _simd_load_ps((const float*)(pSrc + (FormatTraits<DstFormat>::swizzle(2))*offset)); // float32 bbbbbbbb
+ simdscalar vComp3 = _simd_load_ps((const float*)(pSrc + (FormatTraits<DstFormat>::swizzle(3))*offset)); // float32 aaaaaaaa
// clamp
vComp0 = _simd_max_ps(vComp0, _simd_setzero_ps());
}
// convert float components from 0.0f .. 1.0f to correct scale for 0 .. 255 dest format
- vComp0 = _simd_mul_ps(vComp0, _simd_set1_ps(FormatTraits<DstFormat>::fromFloat(0)));
+ vComp0 = _simd_mul_ps(vComp0, _simd_set1_ps(FormatTraits<DstFormat>::fromFloat(0)));
vComp1 = _simd_mul_ps(vComp1, _simd_set1_ps(FormatTraits<DstFormat>::fromFloat(1)));
vComp2 = _simd_mul_ps(vComp2, _simd_set1_ps(FormatTraits<DstFormat>::fromFloat(2)));
vComp3 = _simd_mul_ps(vComp3, _simd_set1_ps(FormatTraits<DstFormat>::fromFloat(3)));
// moving to 8 wide integer vector types
simdscalari src0 = _simd_cvtps_epi32(vComp0); // padded byte rrrrrrrr
- simdscalari src1 = _simd_cvtps_epi32(vComp1); // padded byte gggggggg
- simdscalari src2 = _simd_cvtps_epi32(vComp2); // padded byte bbbbbbbb
+ simdscalari src1 = _simd_cvtps_epi32(vComp1); // padded byte gggggggg
+ simdscalari src2 = _simd_cvtps_epi32(vComp2); // padded byte bbbbbbbb
simdscalari src3 = _simd_cvtps_epi32(vComp3); // padded byte aaaaaaaa
#if KNOB_ARCH <= KNOB_ARCH_AVX
static const uint32_t offset = sizeof(simdscalar);
// swizzle rgba -> bgra while we load
- simdscalar vComp0 = _simd_load_ps((const float*)(pSrc + (FormatTraits<DstFormat>::swizzle(0))*offset)); // float32 rrrrrrrr
+ simdscalar vComp0 = _simd_load_ps((const float*)(pSrc + (FormatTraits<DstFormat>::swizzle(0))*offset)); // float32 rrrrrrrr
simdscalar vComp1 = _simd_load_ps((const float*)(pSrc + (FormatTraits<DstFormat>::swizzle(1))*offset)); // float32 gggggggg
- simdscalar vComp2 = _simd_load_ps((const float*)(pSrc + (FormatTraits<DstFormat>::swizzle(2))*offset)); // float32 bbbbbbbb
+ simdscalar vComp2 = _simd_load_ps((const float*)(pSrc + (FormatTraits<DstFormat>::swizzle(2))*offset)); // float32 bbbbbbbb
// clamp
vComp0 = _simd_max_ps(vComp0, _simd_setzero_ps());
vComp0 = _simd_min_ps(vComp0, _simd_set1_ps(1.0f));
// moving to 8 wide integer vector types
simdscalari src0 = _simd_cvtps_epi32(vComp0); // padded byte rrrrrrrr
- simdscalari src1 = _simd_cvtps_epi32(vComp1); // padded byte gggggggg
- simdscalari src2 = _simd_cvtps_epi32(vComp2); // padded byte bbbbbbbb
+ simdscalari src1 = _simd_cvtps_epi32(vComp1); // padded byte gggggggg
+ simdscalari src2 = _simd_cvtps_epi32(vComp2); // padded byte bbbbbbbb
#if KNOB_ARCH <= KNOB_ARCH_AVX
return GenericStoreTile::Store(pSrc, pDstSurface, x, y, sampleNum, renderTargetArrayIndex);
}
- uint8_t *pDst = (uint8_t*)ComputeSurfaceAddress<false, false>(x, y, pDstSurface->arrayIndex + renderTargetArrayIndex,
+ uint8_t *pDst = (uint8_t*)ComputeSurfaceAddress<false, false>(x, y, pDstSurface->arrayIndex + renderTargetArrayIndex,
pDstSurface->arrayIndex + renderTargetArrayIndex, sampleNum, pDstSurface->lod, pDstSurface);
const uint32_t dx = SIMD16_TILE_X_DIM * DST_BYTES_PER_PIXEL;
const uint32_t dy = SIMD16_TILE_Y_DIM * pDstSurface->pitch - KNOB_TILE_X_DIM * DST_BYTES_PER_PIXEL;
- uint8_t* ppDsts[] =
+ uint8_t* ppDsts[] =
{
pDst, // row 0, col 0
pDst + pDstSurface->pitch, // row 1, col 0
return GenericStoreTile::Store(pSrc, pDstSurface, x, y, sampleNum, renderTargetArrayIndex);
}
- uint8_t *pDst = (uint8_t*)ComputeSurfaceAddress<false, false>(x, y, pDstSurface->arrayIndex + renderTargetArrayIndex,
+ uint8_t *pDst = (uint8_t*)ComputeSurfaceAddress<false, false>(x, y, pDstSurface->arrayIndex + renderTargetArrayIndex,
pDstSurface->arrayIndex + renderTargetArrayIndex, sampleNum, pDstSurface->lod, pDstSurface);
const uint32_t dx = SIMD16_TILE_X_DIM * DST_BYTES_PER_PIXEL;
{
struct swr_context *ctx = (struct swr_context *)
AlignedMalloc(sizeof(struct swr_context), KNOB_SIMD_BYTES);
- memset(ctx, 0, sizeof(struct swr_context));
+ memset((void*)ctx, 0, sizeof(struct swr_context));
swr_screen(p_screen)->pfnSwrGetInterface(ctx->api);
swr_screen(p_screen)->pfnSwrGetTileInterface(ctx->tileApi);
struct swr_context *ctx,
swr_fragment_shader *swr_fs)
{
- memset(&key, 0, sizeof(key));
+ memset((void*)&key, 0, sizeof(key));
key.nr_cbufs = ctx->framebuffer.nr_cbufs;
key.light_twoside = ctx->rasterizer->light_twoside;
struct swr_context *ctx,
swr_vertex_shader *swr_vs)
{
- memset(&key, 0, sizeof(key));
+ memset((void*)&key, 0, sizeof(key));
key.clip_plane_mask =
swr_vs->info.base.clipdist_writemask ?
swr_generate_fetch_key(struct swr_jit_fetch_key &key,
struct swr_vertex_element_state *velems)
{
- memset(&key, 0, sizeof(key));
+ memset((void*)&key, 0, sizeof(key));
key.fsState = velems->fsState;
}
struct swr_context *ctx,
swr_geometry_shader *swr_gs)
{
- memset(&key, 0, sizeof(key));
+ memset((void*)&key, 0, sizeof(key));
struct tgsi_shader_info *pPrevShader = nullptr;
struct swr_context *ctx,
swr_tess_control_shader *swr_tcs)
{
- memset(&key, 0, sizeof(key));
+ memset((void*)&key, 0, sizeof(key));
struct tgsi_shader_info *pPrevShader = &ctx->vs->info.base;
struct swr_context *ctx,
swr_tess_evaluation_shader *swr_tes)
{
- memset(&key, 0, sizeof(key));
+ memset((void*)&key, 0, sizeof(key));
struct tgsi_shader_info *pPrevShader = nullptr;
assert(num_elements <= PIPE_MAX_ATTRIBS);
velems = new swr_vertex_element_state;
if (velems) {
- memset(&velems->fsState, 0, sizeof(velems->fsState));
+ memset((void*)&velems->fsState, 0, sizeof(velems->fsState));
velems->fsState.bVertexIDOffsetEnable = true;
velems->fsState.numAttribs = num_elements;
for (unsigned i = 0; i < num_elements; i++) {